Created
May 4, 2021 21:51
-
-
Save borislavstoychev/745debc89999f280b2cd8deb2053eeb6 to your computer and use it in GitHub Desktop.
demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let evenSum = 0; | |
let oddSum = 0; | |
for (const n of String(num)) { | |
Number(n) % 2 == 0 ? evenSum += Number(n) : oddSum += Number(n) | |
} | |
return ` Odd sum = ${oddSum}, Even sum = ${evenSum}`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment