0

Not sure why I am getting this error. I double checked to see if I was repeating myself or if I potentially had other files open with the same name but that is not the case.

let img = document.querySelector("img")
const button = document.querySelector("button")
let name = document.querySelector("#name")
let lastName = document.querySelector("#lastName")
let location = document.querySelector("#location")
let phone = document.querySelector("#phone")
let email = document.querySelector("#email")

const listOfNames = ["Chase", "Bob", "Kyle", "Jason", "Ryan", "Devin", "Josh", "Mark"]

const listOfLastNames = ["Hudson", "Booker", "Johnson", "Miller", "Jones", "Anderson", "Brown", "Smith"]

const listOfLocations = ["Arizona", "California", "Florida", "Colorado", "Washington", "Texas", "Georgia", "New York"]

const listOfPhoneNumbers = ["225-392-7634", "505-614-4307", "415-429-4932", "802-326-5981", "407-248-7518", "646-423-3519", "864-557-5057", "570-835-9163"]

const listOfEmail = ["layla81@yahoo.com", "colleen1@yahoo.com", "garrett.leffler@gmail.com", "harry_schumm58@gmail.com", "cary68@gmail.com", "amy_yost@yahoo.com", "nick81@hotmail.com", "nikita.towne@yahoo.com"]

button.addEventListener("click", function () {
    let randNum = Math.floor(Math.random() * 7)
    console.log(randNum)
})
  • Use [JavaScript modules](//developer.mozilla.org/en/docs/Web/JavaScript/Guide/Modules), or make sure that you linter is configured to module source code. `let location` in global scope won’t work in scripts because it clashes with [`window.location`](//developer.mozilla.org/en/docs/Web/API/Window/location). Firefox has a more descriptive error message: _“Uncaught `SyntaxError`: redeclaration of non-configurable global property `location`”_. – Sebastian Simon Dec 19 '22 at 23:08

0 Answers0