- Learning Node.js Development
- Andrew Mead
- 174字
- 2021-06-30 18:56:57
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.
推薦閱讀
- Mastering Node.js(Second Edition)
- Truffle Quick Start Guide
- 物聯(lián)網(wǎng)信息安全
- 物聯(lián)網(wǎng)概論(第2版)
- 互聯(lián)網(wǎng)基礎(chǔ)資源技術(shù)與應(yīng)用發(fā)展態(tài)勢(shì)(2021—2023)
- 物聯(lián)網(wǎng)技術(shù)與應(yīng)用
- CCNP TSHOOT(642-832)認(rèn)證考試指南
- C/C++串口通信:典型應(yīng)用實(shí)例編程實(shí)踐
- 面向5G-Advanced的關(guān)鍵技術(shù)
- 6G無(wú)線網(wǎng)絡(luò)空口關(guān)鍵技術(shù)
- 網(wǎng)絡(luò)AI+:2030后的未來(lái)網(wǎng)絡(luò)
- 5G+區(qū)塊鏈
- 轉(zhuǎn)化:提升網(wǎng)站流量和轉(zhuǎn)化率的技巧
- INSTANT LinkedIn Customization How-to
- 5G技術(shù)核心與增強(qiáng):從R15到R17