Important Notice:

forEach() Method

forEach() Method

24 views 1 min read

forEach() Method (एरे के लिए)

हिंदी व्याख्या: forEach() एक Array method है जो हर element पर function चलाता है।

JavaScript
 
let numbers = [10, 20, 30, 40];

numbers.forEach(function(num, index)
 { document.write("Index " + index + " = " + num + "<br>");

 });
 Output:-
Index 0 = 10 Index 1 = 20 Index 2 = 30 Index 3 = 40

English Explanation: forEach() is an array method that executes a function for each element.

Related Notes