Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const myArray = [1, 3, 5, 7];
- function callback(elem, index, array) {
- console.log({e: elem + 10, i: index - 1, arr: array});
- }
- function myForEach(arr, callback){
- for (let i = 0; i < arr.length; i++){
- callback(arr[i], i, arr);
- }
- }
- const result = myForEach(myArray, callback);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement