How am i wrong, did exactly as told

Tell us what’s happening:
Describe your issue in detail here.
I am getting the output to 8, but its still telling me to use lastName.length, which I have done. What else can I do?

Your code so far

// Setup
let lastNameLength = 0;
const lastName = "Lovelace";

// Only change code below this line
lastNameLength = 8;

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36

Challenge: Find the Length of a String

Link to the challenge:

you are supposed to update the value of the variable lastNameLength programmatically, not just assign it to 8.


What do you mean for this to log? The length of the string contained in lastName (in this case, "Lovelace") or the length of the string "lastName" itself?

1 Like

What do you need to solve? What’s the challenge, objective, and where you’re stuck at?

@RealLeon Does the feedback from @snowmonkey make sense?

“last name” is a string with 9 spots. Plus, is it hardwired for only that single string
But the variable lastName stores “Lovelace” which is a string with 8 spots.

Check this out
let userName = “@RealLeon” assign the string to a variable
let count =userName.length assign the number spots with the string attribute length
@RealLeon and “userName” are two different strings.

Wow, this is a great question because I have never seen anyone hardwire anything before .length. We must all just copy from examples only. Even hardwiring works, please stop.

Knock 'em dead!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.