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)

βœ”οΈβœ”οΈ

Top comments (0)

Create an Account!
Now it's your turn!
Β 
πŸ—’ Share a tutorial
πŸ€” Reflect on your coding journey
❓ Ask a question

Create an account to join hundreds of thousands of DEV members on their journey.