Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hola grupo tengo un problema realizando la practica de modulos de learnyounode #2959

Open
Aguila018 opened this issue Aug 26, 2024 · 0 comments

Comments

@Aguila018
Copy link

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.
respuesta

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@Aguila018 and others