Q:

use .map to count length of each element in an array

var words = ['Hello', 'world'];

var lengths = words.map(function(word) {
  return word + ' = ' + word.length;
});

console.log(lengths);
0
var lengths = chars.map(function(word){
 return word.length
}) 
0

New to Communities?

Join the community