Basic JavaScript - Find the Length of a String

Tell us what’s happening:

I can’t get the length of lastName.
Your code so far

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

// Only change code below this line
lastName.length
lastNameLength = 8;

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0

Challenge: Basic JavaScript - Find the Length of a String

Link to the challenge:

You need to assign the length of the string lastName to the variable lastNameLength, using the .length() property.

You shouldn’t explicitly set a value (e.g. lastNameLength=8).

If you instead use the .length() property, it means that whatever string is assigned to lastName, the value for lastNameLength will always be correct.

1 Like

Worked! Thanks mate.

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