← Back to Arrays
Question 103
Square the Even Numbers
Square the Even Numbers
Array methods can be chained: the result of one becomes the input to the next. You are given an array of numbers. First use filter to keep only the even numbers, then use map to square each of those (multiply it by itself). Print the final array with one console.log.Expected Output:
4,16,36,64= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Arrays
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (clog, fn, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.