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);