Debugging Help

1. Check the console for errors

TypeError: Cannot read properties of null - go to step 2

ReferenceError: something is not defined - go to step 3

2. Check that your IDs in HTML match your IDs in JavaScript

HTML

<yourTag id="yourId"></yourTag>

JavaScript

let yourVariable = document.getElementById(`yourId`)
3. Check that your JavaScript variable names match
let yourVariable = document.getElementById(`yourId`)

yourVariable.addEventListener(`click`, yourFunction)
4. Check that you are adding an event listener
yourVariable.addEventListener(`click`, yourFunction)

function yourFunction() {
  // your code here
}
5. Pretend you are the computer and walk through your code

console.log your variables and check that they have the expected values