javascript object with attributes to variables code example
Example 1: javascript object get property or default
// won't work if obj.property is falsey
let value = obj.property || "default";
Example 2: get object name javascript
var a = {
name:'a',
'light': 'good',
'dark' : {
name: 'dark',
'black': 'bad',
'gray' : 'not so bad'
}
}
// This way you can do
console.log(a.name,a.dark.name);