Basic JavaScript - Find the Length of a String

Cannot figure out the issue
Cannot solve it.

Your code so far

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

// Only change code below this line
console.log("Lovelace".lenght)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0

Challenge: Basic JavaScript - Find the Length of a String

Link to the challenge:

1 Like

you need to correct the spelling of the word length (you wrote length)

I’ve made that but it is still not working.:slightly_frowning_face:

What is your updated code?

Also, why did you delete the variable that the result is stored into?

// Setup

let lastNameLength = 0;

const lastName = "Lovelace";

// Only change code below this line

lastNameLength = 8;

console.log(lastName.length);

You should not use a hard coded number here.

I’ve fixed it but it is still not working.

How did you fix it? Can you share your new code?

// Setup

let lastNameLength = 0;

const lastName = “Lovelace”;

// Only change code below this line

lastNameLength = lastName;

console.log(lastName.length);

You aren’t getting the length here anymore. This says, in words, “the length of the lastName is the lastName itself”.