Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!