Answers for "i have a function which i would like to use for an array loops"

2

how to get value in array object value using for loop in javascript

const myArray = [{x:100}, {x:200}, {x:300}];

const newArray= myArray.map(element => element.x);
console.log(newArray); // [100, 200, 300]
Posted by: Guest on May-11-2020
0

what is the modern syntax for iterating through array using for loop in javascript

let friends=["jony","tom","Tejas"];
       friends.forEach(
           function f(i){
               console.log(i);
           }
       )
Posted by: Guest on July-03-2020

Code answers related to "i have a function which i would like to use for an array loops"

Code answers related to "Javascript"

Browse Popular Code Answers by Language