-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Description
Notes
Me pide realizar dos archivos uno llamado program.js y otro mymodulo,js para exportar una funcion y asi hago los codigos
// modulo
const fs = require ("fs");
const path = require("path");
function solucion () {
let encontrar = fs.readdir(process.argv[2] , (err,files) => {
if(err){
console.error(err);
}else {
const txtFiles = files.filter(file => file.endsWith('.md'));
txtFiles.forEach(file => {
console.log(file);
});
}
});
}
module.exports = {solucion};
// principal que es program.js
const fs = require('fs');
const path = require("path");
const recibe = require ("./mymodule");
console.log(recibe.solucion());
// la respuesta que me da esta en la imagen. espero que me ayuden, saludos.

- If you have a question about the NodeSchool organization: Please open an issue in nodeschool/organizers
- If you want to improve or contribute to workshoppers: Please open an issue in workshopper/org
- Did you see the guide for questions? https://github.com/nodeschool/discussions#when-you-have-a-problem
Please delete this section after reading it
If you have a problem with an error message:
- node version: <run "node -v" in you terminal and replace this>
- npm version: <run "npm -v" in you terminal and replace this>
- os: windows 7/windows 10/mac/linux
Error output
// copy your error output here
My Code
// copy your code here