• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

209
Views
the content is too long, How to display the complete content in console.log()?

I have a big array, it has many element,
I need to display it in console,
I use console.log() but only a part of it was displayed.

How to display full content?

enter image description here

almost 3 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Run it through JSON.stringify so you are logging a single string and not a complex data structure.

almost 3 years ago · Juan Pablo Isaza Report

0

as say here How can I get the full object in Node.js's console.log(), rather than '[Object]'?

you can convert your element (object or array) directly in json by using

console.log('my elem : %j', myObject);

or if you want more display option, you can use util.inspect

const util = require('util')
console.log(util.inspect(myObject, {showHidden: false, depth: null, colors: true}))
almost 3 years ago · Juan Pablo Isaza Report

0

You can use

 console.dir(myArry, {'maxArrayLength': null});

The console method log() displays the toString representation of any object passed to it. The Console method dir() displays an interactive list of the properties of the specified JavaScript object

Link for reference : Dumping whole array: console.log and console.dir output "... NUM more items]"

almost 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error