How to properly organize check mat. conditions?

  • 0
    There is a sandbox file:

    Tell me how to implement:
    The last field 'condition' must contain a condition of the type (a1 & gt; b1), if it is true the field is highlighted in green, no - in red.
    I don't understand how to properly organize the reading of the condition itself.
    JavaScript Anonymous, Aug 16, 2020

  • 2 Answers
  • 0
    var checkCondition = new Function ('a1, b1, a2, b2', 'return' + condition.value);

    if (checkCondition (+ (a1.value), + (b1.value), + (a2.value), + (b2.value))) { = '# b6d7a8';

    } else { = '#fff';


  • 0
    To begin with, give examples of what may be there; a1 and b1 are constants or expressions with variables? Otherwise, expressions like sin (x) & lt; = 1 for any x are possible - but the computer can get tired of proving it.

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!