Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 574 characters in body
Source Link
noodle person
  • 12.6k
  • 1
  • 31
  • 90

JavaScript (Node.js), 2623 bytes

n=>eval([...n].join`+`)

Try it online!

Takes input as a string

JavaScript (Node.js) , 26 bytes

n=>eval([...""+n].join`+`)

Try it online!

Takes input as a number, doesn't work if the number is too large for JavaScript to stringify naturally

JavaScript (Node.js), 26 bytes

n=>eval([...""+n].join`+`)

Try it online!

JavaScript (Node.js), 23 bytes

n=>eval([...n].join`+`)

Try it online!

Takes input as a string

JavaScript (Node.js) , 26 bytes

n=>eval([...""+n].join`+`)

Try it online!

Takes input as a number, doesn't work if the number is too large for JavaScript to stringify naturally

Source Link
noodle person
  • 12.6k
  • 1
  • 31
  • 90

JavaScript (Node.js), 26 bytes

n=>eval([...""+n].join`+`)

Try it online!

AltStyle によって変換されたページ (->オリジナル) /