Are these possible in Javascript?
I've got something like this:
var op1 = "<";
var op2 = ">";
if (x op1 xval && y op2 yval) {
console.log('yay');
}
Basically I need the user to input the operator, its coming from a select box.
Are these possible in Javascript?
I've got something like this:
var op1 = "<";
var op2 = ">";
if (x op1 xval && y op2 yval) {
console.log('yay');
}
Basically I need the user to input the operator, its coming from a select box.
It's not nice, but possible:
var op1 = "<";
var op2 = ">";
if (eval("x"+op1+xval+" && y"+op2+yval)) {
console.log('yay');
}
Also see my jsfiddle.
I would prefer bobbymcr answer.