Check if the Formula is Correct

Published by Matt in

Create a function that takes a string and returns true or false depending on whether or not the formula is correct.

Examples

formula("6 * 4 = 24") ➞ true

formula("18 / 17 = 2") ➞ false

formula("16 * 10 = 160 = 14 + 120") ➞ false

Notes

  • You have to figure out what a is.
  • You do not need to dynamically find the value of a (it's a constant and the same accross all tests).
  • Ignore the spaces.
Watch a quick demo on how Edabit works.