I do not know what is meant by "You should be getting the length of lastName by using .length like this: lastName.length."

Tell us what’s happening:

Your code so far

// Setup
var lastNameLength = 0;
var lastName = "Lovelace";

// Only change code below this line

lastNameLength = lastName.lenght;
lastNameLength = 8;

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36.

Challenge: Find the Length of a String

Link to the challenge:

You have a small typo.

You misspelled length at line 7.

More importantly, you do not need to put in the line lastNameLength = 8;
The line above it will automatically set the variable lastNameLength to 8. That is the purpose of String.length. lastName.lenghth will give you back the amount of characters contained in the string lastName.
So lastNameLength = 8; in your code is changing the value of lastNameLength from 8 to 8.

1 Like