January 2018
Beginner
658 pages
13h 10m
English
Now, there is one more thing I want to tackle before we wrap up this section. Inside app.js we now have the same code in two places. We have the space or title body in the add command as well as in the read command:
if (command === 'add') { var note = notes.addNote(argv.title, argv.body); if (note) { console.log('Note created'); console.log('--'); console.log(`Title: ${note.title}`); console.log(`Body: ${note.body}`); } else { console.log('Note title taken'); } } else if (command === 'list') { notes.getAll(); } else if (command === 'read') { var note = notes.getNote(argv.title); if (note) { console.log('Note found'); console.log('--'); console.log(`Title: ${note.title}`); console.log(`Body: ${note.body}`); } else { console.log('Note ...Read now
Unlock full access