Guest User

Untitled

a guest
Feb 13th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. /*
  2. Write a function called "isEven".
  3.  
  4. Given an array of numbers, "isEven" returns a new array
  5. that contains only the even numbers of the input array.
  6.  
  7. For example...
  8.  
  9. var output = isEven([1, 4, 5, 6, 10, 13]);
  10. console.log(output); // --> [4, 6, 10]
  11. */
  12.  
  13. // Starter code
  14.  
  15. function isEven(num) {
  16. var output = [];
  17. for (var i = 0; i <= array.length; i++) {
  18. if (array[i] % 2 === 0) {
  19. output.push(array[i]);
  20. }
  21. }
  22. return output;
  23. }
Add Comment
Please, Sign In to add comment