Array Methods-FOR EACH
// FOR EACH can be declared in
// 1
let arr = [12, 2, 4, 5, 6];
let print = function (el) {
console.log(el);
};
arr.forEach(print);
// 2
arr.forEach(function (el) {
console.log(el);
});
// 3
arr.forEach((el) => {
console.log(el);
});
let student=[{
name:"abhi",
marks:98,
},
{
name:"ash",
marks:96,
},{
name:"bharath",
marks:99,
},{
name:"vinay",
marks:98,
},
];

Comments
Post a Comment