Check out example codes for "use .map to count length of each element in an array". It will help you in understanding the concepts better.

Code Example 1

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

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

console.log(lengths);

Code Example 2

var lengths = chars.map(function(word){
 return word.length
})

Learn ReactJs, React Native from akashmittal.com