"lenght" is not working on node.js

Problem description:
Trying to use .lenght to count the size of an array to reproduce a list, but the command doesn’t work.

Expected behavior:
Print a list with the elements inside array.

Actual behavior:
Nothing happens.

Steps to reproduce:

const colorido = [“Azul”, “Amarelo”, “Verde”, “Vermelho”];

let indice = 0;

while (indice < colorido.lenght) {
console.log(colorido[indice]);
indice++;
}

Bug appears at this link:
https://replit.com/@MarceloSiriaki/testing-for#index.js

Browser/OS/Device:
Chrome

You are spelling it wrong. The correct spelling is “length” not “lenght”.

4 Likes

Could you mark CoderElijah’s answer as the solution?

1 Like

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