Advertisement
kpdan95

Untitled

Feb 16th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. const myArray = [1, 3, 5, 7];
  2.  
  3. function callback(elem, index, array) {
  4. console.log({e: elem + 10, i: index - 1, arr: array});
  5. }
  6.  
  7. function MyForEach(arr){
  8. for (let i = 0; i < arr.length; i++){
  9. callback(arr[i], i, arr);
  10. }
  11. }
  12.  
  13. const result = MyForEach(myArray);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement