Self-reading

Report a typo

Add some code in the indicated places, which will allow you to read the file and print the second word in the file in the string data type (not a buffer!) to the console. Perhaps the split method for strings will help you highlight the first word.

Write a program in JavaScript
const fs = require('fs'); //do not change this line

const data = fs.readFile('main.js', /* your code */, (err, data) => {
/* your code */
});
___

Create a free account to access the full topic