how to use an array in function in for loop code example
Example 1: how to get value in array object value using for loop in javascript
const people = [
{name: 'John', age: 23},
{name: 'Andrew', age: 3},
{name: 'Peter', age: 8},
{name: 'Hanna', age: 14},
{name: 'Adam', age: 37}];
const anyAdult = people.some(person => person.age >= 18);
console.log(anyAdult);
Example 2: 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);
}
)