loading...

Javascript: Printing Object in Console

victoromondi1997 profile image VICTOR OMONDI ・1 min read

If you're trying to print object in console and you're getting [object Object], then most probably you're trying to print the object as a string value. Add comma(,), and not plus operator(+)

Ex:

console.log('The value of object is: ' + obj) 

❌❌

console.log('The value of object is: ' , obj)

✔️✔️

Discussion

pic
Editor guide