Find the Length of a String help me

Tell us what’s happening:

Your code so far


// Example
var firstNameLength = 0;
var firstName = "Ada";

firstNameLength = firstName.length;

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

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


Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string

just use lastNameLength = lastName.length

1 Like

we need to add
Use the .length property to count the number of characters in the lastName variable and assign it to lastNameLength .
so first we put
lastNameLength on a new line

lastNameLength

then just like with myName in one of the previouse lesson we add a =

lastNameLength =

then as we read the instruction: For example, if we created a variable var firstName = "Charles" , we could find out how long the string "Charles" is by using the firstName.length property.
so the last part becomes lastName.lenght
then we of course close of with a ;

lastNameLength = lastName.length;
1 Like