← Back to challenges

Are the Sum of Digits in the Numbers Equal?

JavaScriptHardarrayslanguage_fundamentalsvalidationconditions

Instructions

Write a function that takes an array of two numbers and determines if the sum of the digits in each number are equal to each other.

Examples

isEqual([105, 42]) ➞ true
# 1 + 0 + 5 = 6
# 4 + 2 = 6

isEqual([21, 35]) ➞ false

isEqual([0, 0]) ➞ true

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Count the Points in a Circle