January 2018
Beginner
658 pages
13h 10m
English
Let's take a quick look at how that works. What we'll do is to define an age property using module.exports, the object we just explored over in Terminal. Also, we know that it's an object because we can see it in the preceding screenshot (exports: {}); this means that I can add a property, age, and set it equal to my age, which is 25, as shown here:
console.log('Starting notes.js');module.exports.age = 25;
Then I can save this file and move into app.js to take advantage of this new age property. The const variable notes will be storing all of my exports, in the present case, just age.
In fs.appendFile, after the greeting.txt file, I'll add You are followed by the age. Inside template strings, ...