1
Eae , I’m studying by the book JS Definitive Guide and I’m seeing many examples where length is used in 'for', and I’m in doubt why use length if (from what I know) it only takes length if it’s a string. EX:
var x = 15
var y = 'haha'
console.log(x.length) // Undefined
console.log(y.length) // 4
Example of the Book
for(var i = 0; i < keys.length; i++) { // Para cada índice no array
var key = keys[i]; // Obtém a chave nesse índice
values[i] = o[key]; // Armazena o valor no array values
}
So why use length as in the above example ?