JSFiddle - React, Tailwind, and code Playground
HTML
<div id="display"></div>
JavaScript
var write = function (val) {
var display = document.getElementById('display');
display.innerHTML = JSON.stringify(val);
};
var person = {
name: 'John Doe',
age: 44,
isMarried: true,
spouse: {
name: 'Jane Doe',
age: 45
}
};
// Using dot or subscript notation, change the person's and spouse's names
person.name = 'Jeff Ray';
person.spouse.name = 'Jesse Ray';
// Add favoriteColor properties to both person and the spouse subobject.
person.favoriteColor = 'Crimson';
perosn.spouse.favoriteColor = 'Mauve';
write(person);