So I am looking for something similar to this question python if statement with variable mathematical operator but in jQuery/Javascript
Essentially something like
var one = "4";
var two = "6";
var op = "==";
if (one op two) {
//do something
}
is this possible?
You could define a lot of binary functions:
If you don’t want to generate such a large object and have no complex functions, you also might be able to generate them on-the-fly (using a bit of
evalmagic):