DEV Community

VICTOR OMONDI
VICTOR OMONDI

Posted on

 

Javascript: Printing Object in Console

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)

✔️✔️

Oldest comments (0)

👋 Haven't Posted on DEV Yet?

Head over to our Welcome Thread and tell us a bit about yourself!