Reputation: 795
I'm doing an AssertEval on 2 numbers and as long as they are the exact same, it passes. My issue is that the numbers can be within 5 of each other, either way. Currently, if they don't match, the script fails.
I'm very new at javascript. Can somebody please show me how I would handle this?
Example: Num1 = 20
Num2 can be anywhere from 15 - 25 to still pass the Eval.
Upvotes: 0
Views: 732
Reputation: 2461
Here you go. This is the javascript that does the check of +/- 5. then compares the output using an assertEval
<tr>
<td>assertEval</td>
<td>var num1=20; var num2=19; ( (num1 + 5) > num2) && ( (num1 - 5) < num2);</td>
<td>true</td>
</tr>
Upvotes: 1