what am i doing wrong
i dont know what ive been doing wrong. im doing what the website wants me to do. im so stuck AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
// Setup
let lastNameLength = 0;
const lastName = “Lovelace”;
// Only change code below this line
lastNameLength = lastName.length;
console.log(LastNameLength)
// Setup
let lastNameLength = 0;
const lastName = "Lovelace";
// Only change code below this line
lastNameLength = lastName.length;
console.log(LastNameLength)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Challenge: Basic JavaScript - Find the Length of a String
Link to the challenge:
hbar1st
December 12, 2022, 7:34pm
#2
naveeda6087:
LastNameLength
this variable LastNameLength is not the same as lastNameLength
(the later one is the one you want to log if needed)
You don’t have to put the last console.log(),
and if you want to print it to the console you have to use the variable in which the value is stored
Mod edit: solution redacted
hbar1st
December 12, 2022, 10:54pm
#4
Hi there, please don’t post code solutions on the forum.
JohnG10
December 13, 2022, 1:26am
#5
You have defined lastNameLength = 0;
Then assigned lastNameLength = lastName.length;
which is fine
But you are doing console.log(LastNameLength);
lastNameLength
is not same as LastNameLength
L is capitalised in latter and is not defined.
Instead do console.log(lastNameLength);
Variable name should match exactly.
1 Like