How do solve problems

Tell us what’s happening:

how do I get solution to this problem: find the length of a string

Your code so far


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

// Only change code below this line

lastNameLength = 8;
lastName = lastName.Lenght;

Your browser information:

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

Challenge: Find the Length of a String

Link to the challenge:

The example given is

"Alan Peter".length; // 10

Can you see how that differs from your code? You have a typo and a capitalization issue.

Why are you changing lastName here?

2 Likes

Tell us what’s happening:

Use the .length property to count the number of characters in the lastName variable and assign it to lastNameLength .

Your code so far


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

// Only change code below this line
lastNamelength = 8;
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/86.0.4240.75 Safari/537.36.

Challenge: Find the Length of a String

Link to the challenge:

careful with capital letters, the variable need to match the requested format

Thank you
I have gotten the answer