Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

if there is an invalid expression in eval js then how to get ti

function myFunction() {
    var x = 10;
    var y = 20;
    var res;

    try {
        var a = eval("x * y") + "<br>";
        var b = eval("2 + 2") + "<br>";
        var c = eval("x + 17") + "<br>";
        var d = eval("x + 17 + ") + "<br>";

        res = a + b + c;
    }
    catch (e) {
        res = 'Expression in invalid.';
    }

    $("#demo").html(res);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #invalid #expression #eval #js #ti
ADD COMMENT
Topic
Name
9+1 =