Skip to main content

Code Golf · #34 · 2026-05-08

Square every number

Difficulty 1/3 · JavaScript

How to play

Write a JavaScript function body that passes all test cases using the fewest characters. Run against examples first, then submit for the full test suite. Eagle < Birdie < Par.

Given an array of numbers, return a new array with each number squared.

Examples

f([1,2,3]) 1,4,9
f([-2,0,3]) 4,0,9

Loading your progress...

Your code (function body — receives input)

function(input) { 0 chars
}

Write the shortest JavaScript function body that passes all tests · Back to hub