Semicolon as separator

Report a typo

The readFile method passed a data argument of a string type to the callback. Inside the callback, we displayed the length of the substring of the data variable until the first occurrence of the semicolon. But parts of the code were lost! You need to restore the specified parts of the program for the code to work correctly!

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

const dataAsync = fs.readFile('main.js', /* lost code */, (err, data) => {
console.log(data.split(';')[ ); //part of the code is missing in this line
});
___

Create a free account to access the full topic