← Back to challenges

Is it True?

JavaScriptHardstringsnumbersvalidationlanguage_fundamentals

Instructions

In this challenge you will be given a relation between two numbers, written as a string. Write a function that determines if the relation is true or false.

Examples

isTrue("2=2") ➞ true

isTrue("8<7") ➞ false

isTrue("5=13") ➞ false

isTrue("15>4") ➞ true

Notes

  • Tests will only have three types of relations: =, >, and <
  • Many approaches work here, but the eval() function is particularly useful!
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Calculate the Mean