Basic JavaScript - Find the Length of a String

**Hello , please i cannot pass this task even I do believe my code is correct
any help please

Describe your issue in detail here.

Your code so far

// Setup
let lastNameLength = 0;
const lastName = "Lovelace";

// Only change code below this line
lastNameLength = 8;

console.log (lastName.length);

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

Challenge: Basic JavaScript - Find the Length of a String

Link to the challenge:

You are supposed to use the .length property to calculate the length of the string, rather than set the variable value explicitly to the length of the string as you have done.

For example, if we created a variable const firstName = "Ada", we could find out how long the string Ada is by using the firstName.length property.

Use the .length property to set lastNameLength to the number of characters in lastName.

So, instead of assigning the value 8 to the variable lastNameLength, instead assign a value using the .length property directly.

This means that whatever string is assigned to the variable firstName, your lastNameLength variable will always have the correct value.


Thank you so Much. it took me long time to realize that. I appreciate your help

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