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

0

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);
}
Posted by: Guest on September-11-2021

Code answers related to "if there is an invalid expression in eval js then how to get ti"

Code answers related to "Javascript"

Browse Popular Code Answers by Language