Basic JavaScript - Use Bracket Notation to Find the Nth-to-Last Character in a String

Tell us what’s happening:

My problem does not have to do with the coding, but with the syntax of : .lenght
it gives me an error everytime unless i dont copy-paste it from the example

Your code so far

// Setup
const lastName = "Lovelace";

// Only change code below this line
const secondToLastLetterOfLastName = lastName; // Change this line

Your browser information:

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

Challenge Information:

Basic JavaScript - Use Bracket Notation to Find the Nth-to-Last Character in a String

Spelling matters a lot in coding.

Good news is, in a normal editor, you would get a completion suggestion after adding the dot.

You might even get this:

Property 'lenght' may not exist on type '"Lovelace"'. Did you mean 'length'?ts(2568)
lib.es5.d.ts(517, 14): 'length' is declared here.

well, that i know, the thing is that Im not spelling it wrong.

Can you post the code that you tried? You have not put it above. Put 3 backticks before and after the code.

Have you tried putting “secondToLastLetterOfLastName” through the console log of your code to see what it returns on your code?

The question tells you to use bracket notation not dot notation. Maybe that is why your code isn’t passing?

its honesty not only that one challenge, even in past challenges where I needed to use the
lenghtOfRandomVar=randomVar.lenght → an example
it doesnt go right until i copy paste the .lenght value from the challenge prompt

Welcome to the forum @EddySly

lenghtOfRandom
lenght → an example
lenght value from the challenge 

You need to use lengTH not lengHT.

Happy coding

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