官术网_书友最值得收藏!

Adding notes

To get started with adding notes, the first thing we'll do is create a variable called notes, and for the moment, we'll set it equal to an empty array, just as in the following, using our square brackets:

var addNote = (title, body) => {
var notes = [];
};

Now that we have the empty array, we can go ahead and make a variable called note, which is the individual note. This will represent the new note:

var addNote = (title, body) => {
var notes = [];
var note = {

}
};

On that note, we'll have the two properties: a title and a body. Now, title can be set equal to the title variable, but, as we know, inside ES6, we can simply remove it when both values are the same; so we'll add title and body as shown here:

var addNote = (title, body) => {
var notes = [];
var note = {
title,
body
};
};

Now we have the note and the notes array.

主站蜘蛛池模板: 九龙坡区| 太原市| 云南省| 哈密市| 德州市| 石台县| 溧阳市| 交城县| 泗阳县| 方正县| 鄢陵县| 乐至县| 蕲春县| 耿马| 青冈县| 怀宁县| 平湖市| 台州市| 理塘县| 交城县| 南岸区| 长顺县| 扶风县| 景东| 墨脱县| 班戈县| 共和县| 于田县| 腾冲县| 格尔木市| 根河市| 奉节县| 依安县| 墨竹工卡县| 兴城市| 康定县| 宝清县| 杭锦后旗| 唐河县| 天峨县| 麟游县|