Basic JavaScript - Find the Length of a String

Any one can help me plss:
i can’t pass this task
**// Setup
let lastNameLength = 0;
const lastName = “Lovelace”;

// Only change code below this line

let lastNamelength = lastName.length;
console.log (lastName.length);**

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

// Only change code below this line


 let  lastNamelength = lastName.length;
 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/109.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Find the Length of a String

Link to the challenge:

You shouldnt have let on your second lastNameLength varable. The variable was already used initialized at the top

si i should do what pls ?

You need to remove the word “let” that is in front of your second lastNameLength variable

what should i do ?
// Setup

let lastNameLength = 0;

const lastName = “Lovelace”;

// Only change code below this line

var lastNamelength = lastName.length;

console.log (lastName.length);

There should be nothing in front of your second lastNameLength variable. Get rid of var and put nothing else there

// Setup

let lastNameLength = 0;

const lastName = “Lovelace”;

// Only change code below this line

lastNameLength = lastName;

console.log(lastName.length);
and i get this
// running tests

lastNameLength

should be equal to eight. You should be getting the length of

lastName

by using

.length

like this:

lastName.length

. // tests completed // console output 8

Reset the lesson, but this time do not add var or let in front of the second variable. Only add the code for the length

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