Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

console log object js

const obj={
    firstName: 'John',
    lastName: 'MacDonald',
    age: 32,
    pets: true
};

console.log(obj); // {firstName: 'John', lastName: 'MacDonald', age: 32, pets: true}
console.log(`${obj}`); // [object Object]
console.log(`${JSON.stringify(obj)}`); // {"firstName":"John","lastName":"MacDonald","age":32,"pets":true}
console.log(Object.keys(obj)); // ['firstName', 'lastName', 'age', 'pets']
console.log(Object.values(obj)); // [ 'John', 'MacDonald', 32, true ]
 
PREVIOUS NEXT
Tagged: #console #log #object #js
ADD COMMENT
Topic
Name
5+5 =