January 2018
Beginner
658 pages
13h 10m
English
Let's create an if/else block below the console.log('Command: ', command);. We'll add if (command === 'add'), 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')
In this case, we'll go through the process of adding a new note. Now, we're not specifying the other arguments here, such as the title or the body (we'll discuss that in later sections). For now, if the command does equal add, we'll use console.log to print Adding new note, as shown in the following code:
console.log('Starting app.js');const fs = require('fs');const _ = require('lodash'); ...