Computer scienceBackendNode.jsCore ConceptsInternal modulesFile system module

Watchers

Correct order

Report a typo

You need to collect the files that were changed into two arrays. The first one should hold txt files, and the second one should hold js files. Here's the beginning of the code:

const fs = require('node:fs');

const txtFiles = [];
const jsFiles = [];

Arrange the remaining fragments of code in the correct order.

Put the items in the correct order
jsFiles.push(filename);
txtFiles.push(filename);
}
else if (event === 'change' && filename.endsWith('js')) {
fs.watch('docs', (event, filename) => {
if (event === 'change' && filename.endsWith('txt')) {
}
});
___

Create a free account to access the full topic