Gunakan .map untuk menghitung panjang setiap elemen dalam array
var lengths = chars.map(function(word){
return word.length
})
Wild Whale
var lengths = chars.map(function(word){
return word.length
})
var words = ['Hello', 'world'];
var lengths = words.map(function(word) {
return word + ' = ' + word.length;
});
console.log(lengths);