<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Object basics: Task 1</title>
<link rel="stylesheet" href="../styles.css" />
</head>
<body>
<section class="preview">
</section>
</body>
</html>
p {
color: purple;
margin: 0.5em 0;
}
* {
box-sizing: border-box;
}
const cat = {
name : 'Bertie',
breed : 'Cymric',
color : 'white',
greeting: function() {
console.log('Meow!');
}
}
// Add your code here
const catName = cat['name'];
cat.greeting();
cat.color = 'black';
// Don't edit the code below here!
const section = document.querySelector('section');
let para1 = document.createElement('p');
let para2 = document.createElement('p');
para1.textContent = `The cat's name is ${ catName }.`;
para2.textContent = `The cat's color is ${ cat.color }.`;
section.appendChild(para1);
section.appendChild(para2);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.