Cats and Dogs explainer

The aim of this puzzle: Use JavaScript to create a button and add it to a webpage.

Walkthrough of the solution:
In this puzzle, you’ll use the createElement method, the textContent property, and the appendChild method to create a button and add it to the document body.

To complete the puzzle, create a variable called dogButton that stores a new button element using document.createElement('button'). Then, set the .textContent of dogButton to a string. Finally, append the dogButton element to the body.

To complete the puzzle, create a variable
Sample code solution:
(Tap below to reveal)


let title = document.createElement('h1');
title.textContent = 'Cuteness';

let catImg = document.createElement('img');
catImg.src =  '../../static/images/greyTabby.jpg';

let catButton = document.createElement('button');
catButton.textContent = 'Click Here!';

let dogImg = document.createElement('img');
dogImg.src = '../../static/images/couchDog.jpg';

let dogButton = document.createElement('button');
dogButton.textContent = 'Or Here!';


HTML Concepts: <h1>, <img>, <button>
JavaScript Concepts: .textContent, .createElement(), document body, .appendChild(), Variables

Can some tell me what is wrong in this coding Capture

Hey there, change the string 'Button' to 'button'.

JavaScript is case sensitive, so if you capitalize the B, then document.createElement() doesn’t know what to do with it.

Hope this helps!