Basic JavaScript - Find the Length of a String

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:

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

Hi there, please don’t post code solutions on the forum.

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