Can someone explain a small detail to me?

Tell us what’s happening:

I don’t fully understand the purpose of lastNameLength = lastName; in my code. I got it right, but why does the example and setup above not have lastNameLength = lastName;?

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.

lastNameLength = lastName;
var lastName = "Octomomo";
var lastNameLength = 0;
lastNameLength = lastName.length;

Your browser information:

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

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

the .length is embeded function that has be predefined by javascript it self. So you are passing an variable that is consisted of the letters or characters. So if you want to know the length of your variable, you would use this function to get the integer value(how many characters is in your variable).

I hope that this helped you :slight_smile:

Thank you. Honestly I think I’m tired this morning and it didn’t click in my head.

As you seemed to already suspect, this does not serve a purpose in your code.