You have two functions for reading the file. You need to remove one of the functions so that the string 'Finish' is printed after the contents of the file.
Introduction to fs module
Sync and async styles
Report a typo
Write a program in JavaScript
const fs = require('fs'); //do not change this line
const dataAsync = fs.readFile('main.js', 'utf-8' , (err, data) => {
console.log(data.split(' ').slice(1)[0]);
}); //you can delete this function at all
const dataSync = fs.readFileSync('main.js', 'utf-8');
console.log(dataSync.split(' ').slice(0)[0]);
//or you can delete two lines above
console.log('Finish');
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.