js length code example
Example 1: length of dict js
let dict = {a:1 , b:2 , c:3}
console.log(Object.keys(dict).length)
Example 2: MDN array length
const clothing = ['shoes', 'shirts', 'socks', 'sweaters'];
console.log(clothing.length);
Example 3: js string length
let str = "foo";
console.log(str.length);
Example 4: array length javascript
var numbers = [1, 2, 3, 4, 5];
var length = numbers.length;
for (var i = 0; i < length; i++) {
numbers[i] *= 2;
}
Example 5: javascript string lentrh
var myString = "string test";
var stringLength = myString.length;
console.log(stringLength);
Example 6: javascript longitud de un string
cadena_primitiva = String("barra");
cadena_primitiva = "barra";
cadena_primitiva.length;