How can I test if a mathematical expression is true?
var equation = "1 + 1 = 2";
if (equation === true){
document.write("1 + 1 = 2");
}else{
document.write("1 + 1 =/= 2");
}
For obvious reasons, this code ^^^ doesn't work, but I just wanted to know if there was a function that would do this; evaluate a mathematical expression then return its verity as a boolean (true/false).