Map over properties in array and concat a string - Javascript Array

Javascript examples for Array:map

Description

Map over properties in array and concat a string

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from ww  w .  j  av a  2  s. c  om*/
const authors = [ { id: 1, name: 'Steven'}, {id: 2, name: 'Nick'}]
let names = authors.map( (a, i) => `${a.name} is cool`).join(' ');
console.log(names);
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials