I can’t make the lastNameLength be 8. I also don’t know how? I’ve watched the video over and over again but I still don’t understand it? could I please have some help on this question?
Your code so far
// Setup
let lastNameLength = 0;
const lastName = "Lovelace";
// Only change code below this line
let lastNameLength = lastName.length;
let lastName = "Lovelace";
console.log("Lovelace".length);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 OPR/111.0.0.0
The lastName variable is already declared in third line. So remove the second unnecessary declaration from the 7th line.
See, the lastNameLength is already declared at the top. But you have also declared below which is causing syntax error. So remove the keyword let from the second variable lastNameLength.
You have get the length of lastName variable and stored it in the variable lastNameLength, so you can console it direclty. Replace “Lovelace”.length with lastNameLength in the console statement.