Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

147
Visualizações
Node.js function not showing output in my Visual studio code terminal

I'm trying to learn Node.js and currently I'm studying how to load/export modules and link codes between different files. I've come across this one function that I wrote that doesn't seem to show the intended output in my VS code terminal:

Here is the main handler that I wrote:

yargs.command({
     command: "Read",
     describe: "Reading the note",
       builder: {
       title: {
       describe: "Note title",
       demandOption: true,
       type: "string",
        },
       body: {
            describe: "Note body",
            demandOption: true,
            type: "string",
           },
        },
       handler(argv) {
       notesUtility.readNotes(argv.title);
      },
   });

And here is the module that I'm supposed to export to the handler:

const readNotes = function (title) {
     const notes = loadNotes();
     const note = function (note) {
       if (note.title === title) {
           console.log(chalk.inverse(note.title));
           console.log(note.body);
        } else {
           console.log(chalk.red.inverse("Notes not found!"));
        }
       };
     };

All the other modules that were perfectly fine and showing intended output into my terminal except for this one, I tried debugging it but even the debugger can't seem to pick up this part of the module. It's like it's invisible.

Any one who has an idea what's going on? I hope this question made sense to any one who will read it.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Seems like you do assign the function to the variable note but never call it. You need to invoke it, for example like this note(param)

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda