Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Write a function called "isEven".
- Given an array of numbers, "isEven" returns a new array
- that contains only the even numbers of the input array.
- For example...
- var output = isEven([1, 4, 5, 6, 10, 13]);
- console.log(output); // --> [4, 6, 10]
- */
- // Starter code
- function isEven(num) {
- var output = [];
- for (var i = 0; i <= array.length; i++) {
- if (array[i] % 2 === 0) {
- output.push(array[i]);
- }
- }
- return output;
- }
Add Comment
Please, Sign In to add comment