January 2018
Beginner
658 pages
13h 10m
English
For the solution, the first thing I'll do is to add an else if for read. I'll open and close my curly braces and hit enter right in the middle so everything gets formatted correctly.
In the else if statement, I'll check whether the command variable equals the string read, as shown here:
console.log('Starting app.js');const fs = require('fs');const _ = require('lodash');const notes = require('./notes.js');var command = process.argv[2];console.log('Command: ', command);if (command === 'add') { console.log('Adding new note');} else if (command === 'list') { console.log('Listing all notes');} else if () {} else { console.log('Command not recognized');}
Read now
Unlock full access