← Back to challenges

One Plus One

JavaScriptHardstringsmath

Instructions

Create a function that outputs the result of a math expression in words.

Examples

wordedMath("One plus one") ➞ "Two"

wordedMath("zero Plus one") ➞ "One"

wordedMath("one minus one") ➞ "Zero"

Notes

  • Expect only the operations plus and minus.
  • Expect to only get numbers and answers from 0 to 2.
  • The first letter of the answer must be capitalised.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.