With the readFile method, you should read the file in which this method is located. Then print to the console the length of the substring up to the first occurrence of the opening parenthesis of the data variable. Perhaps the split method will help you.
Introduction to fs module
Substring length
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) => {
/* your code */
});
___
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.