Custom forEach() Exercise
Add a custom forEach() function to Array.prototype, then test it against isEven() and square()
-
forEach(even):
-
[12,453,68,821,-6,0,527].forEach(isEven) ->
- 12 is even
- 453 is not even
- 68 is even
- 821 is not even
- -6 is even
- 0 is even
- 527 is not even
-
forEach(squared):
-
[12,453,68,821,-6,0,527].forEach(squared) ->
- 12 squared is 144
- 453 squared is 205209
- 68 squared is 4624
- 821 squared is 674041
- -6 squared is 36
- 0 squared is 0
- 527 squared is 277729