Basic JavaScript - Find the Length of a String

Tell us what’s happening:

Describe your issue in detail here.

Your code so far

// Setup
let lastNameLength = 0;
const 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/ Safari/537.36 OPR/

Challenge Information:

Basic JavaScript - Find the Length of a String

You want to set lastNameLength to the length of lastName, not to the string stored in lastName.

To get the length of a string we use the dot length method on the variable holding the string.So like in this case we get the length of last name then you assign it to variable LastNameLength.
Then you log in the variable like so

var name = "oslo";

var  stringLength =name.length;

Hope this helps

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