Hey there! This problem might be a bit unpredictable, but give it a go and let us know how you do!
Given a package.json file, how would you fill the blanks in the code to read the file and print out each dependency package name and version?
Given a package.json file, how would you fill the blanks in the code to read the file and print out each dependency package name and version?
const fs = ('fs');
const packageJson = .(fs.('package.json', 'utf8'));
const dependencies = packageJson.dependencies;
console.log('Dependencies:');
(let [package, version] of Object.entries(dependencies)) {
console.log(`${package}: ${version}`);
}Create a free account to access the full topic