Thursday, July 26, 2018

alternative for conditional statements in javascript



ref:https://blog.wax-o.com/2015/05/an-alternative-to-if-else-and-switch-in-javascript/



var result = ( ( {
    45: () => {
return 11;
    },
    11: () => {
return 45;
    },
} )[ 11 ])();

No comments:

Post a Comment

function declaration, expression and call/invoke/execution

  The  function  declaration defines a function with the specified parameters. The  function   keyword can be used to define a function ins...