daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top