One Plus One

Published by Matt in

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.
Watch a quick demo on how Edabit works.