- Learning Node.js Development
- Andrew Mead
- 136字
- 2021-06-30 18:56:59
Moving functionality into individual functions
To resolve the problem, I'd like to get started by creating two new functions:
- fetchNotes
- saveNotes
The first function, fetchNotes, will be an arrow function, and it will not to take any arguments since it will be fetching notes from the filesystem, as shown here:
var fetchNotes = () => {
};
The second function, saveNotes, will need to take an argument. It will need to take the notes array you want to save to the filesystem. We'll set it equal to an arrow function, and then we'll provide our argument, which I will name notes, as shown here:
var saveNotes = (notes) => {
};
Now that we have these two functions, we can go ahead and start moving some of the functionality from addNote up into the individual functions.
推薦閱讀
- EJB 3.1從入門到精通
- 黑客攻防實(shí)戰(zhàn)技術(shù)完全手冊(cè):掃描、嗅探、入侵與防御
- Application Development with Qt Creator(Second Edition)
- Building E-commerce Sites with VirtueMart Cookbook
- Truffle Quick Start Guide
- SEO 20日
- 電子政務(wù)效益的經(jīng)濟(jì)分析與評(píng)價(jià)
- 網(wǎng)絡(luò)創(chuàng)新指數(shù)研究
- HCNA網(wǎng)絡(luò)技術(shù)
- Web Application Development with R Using Shiny
- 物聯(lián)網(wǎng)時(shí)代
- 數(shù)字通信同步技術(shù)的MATLAB與FPGA實(shí)現(xiàn):Altera/Verilog版(第2版)
- 網(wǎng)管工具使用與技巧大全
- Android UI Design
- Hands-On Microservices with Node.js