← Back to challenges

Square Every Digit

JavaScriptHardnumbersalgorithmsmathlanguage_fundamentals

Instructions

Create a function that squares every digit of a number.

Examples

squareDigits(9119) ➞ 811181

squareDigits(2483) ➞ 416649

squareDigits(3212) ➞ 9414

Notes

The function receives an integer and must return an integer.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Clone an Array