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

272
Views
How can I get a specialized log() to accept many arguments?

I have been using this logger in node:

// https://stackoverflow.com/questions/9781218/how-to-change-node-jss-console-font-color
function logC(text) {
  console.log('\x1b[36m%s\x1b[0m', text);
}

However it does not work for multiple arguments. I want to be able to use it like:

logC(text1, text2)

Obviously, I could write out the arguments in the function signature but I was hoping there was a way to do it with the built in arguments.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I think you are looking for this

function logC(...args) {
  args.forEach((arg) => {
    console.log('\x1b[36m%s\x1b[0m', arg);
  })
}
    
logC('a', 'b', 'cccc', 'dsff') // This gives the output
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!