Search
 
SCRIPT & CODE EXAMPLE
 

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);
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery auto idle logout 
Javascript :: my saved scripts 
Javascript :: discord js kick command 
Javascript :: python to javascript converter 
Javascript :: how to prevent todos from vanishing after refreshing page - javascript 
Javascript :: node app not visible in browser aws ec2 
Javascript :: Javacript code that delays, based on Milliseconds 
Javascript :: ajax slick slidre 
Javascript :: for loop shothand in js 
Javascript :: javascript get token from query string 
Javascript :: React svg element rating 
Javascript :: javascript replace char if not present another character 
Javascript :: how to swap two variable values in js 
Javascript :: how to make a popeyes chicken sandwich 
Javascript :: como fazer um array em javascript stackoverflow 
Javascript :: state changes when changing route useContext next 
Javascript :: reading data from link in javascript 
Javascript :: filter syntax 
Javascript :: ternary operator return date greeting 
Javascript :: how to regexp replace with uppercase on specific capture group in js 
Javascript :: click to enlarge in javascript 
Javascript :: javascript categories input object example 
Javascript :: convert js to typescript online 
Javascript :: npm ERR! peer react@"^15.x.x" from react-html-table-to-excel@2.0.0 
Javascript :: Merge Arrarys of Object of Any size 
Javascript :: Parsing an array returned from a function JS 
Javascript :: duplicate serial numbers asset 
Javascript :: reactjs .map is not a function 
Javascript :: js parse money value 
Javascript :: mongo look for substring of field 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =