Find the Length of a String Help .length

Can anyone explain what is given here in very very very simple way.
Describe your issue in detail here.

Your code so far

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

// Only change code below this line

lastNameLength = lastName;

Your browser information:

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

Challenge: Find the Length of a String

Link to the challenge:

Hi Javed !
You have to find length of "Lovelace" .You just have to put a .length right after it(no space). The result will be 8.

Thank you very much for the answer. I actually do not understand the differences in lastNamelength, lastName and lastName.length and also lastNamelength = lastName.length.

the wording of this can be tricky; but in a few days/weeks it will click :slight_smile:

var howManyLettersAreInVariableA = 0;  // this is a number. 
var A = "NAME";

howManyLettersAreInVariableA = A.length ;  //this is still a number, taking NAME and counting the number of letters

Thank you for your answer.

1 Like

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