I want to execute my add function with the following Code. But I'm not getting the right syntax.
I have already tried x.add(3,4) and x().add(3,4), but that doesn't work.
Please let me know where I am going wrong.
<html>
  <body>
    <p>
      After a function has been stored in a variable, 
      the variable can be used as a function:
    </p>
    <p id="demo">
      hello
    </p>
    <script>
      var x = function () {
        var add = function(a, b) { return a + b };
        var mul = function(a, b) { return a * b };
      }();
      document.getElementById("demo").innerHTML = x.add(3,4);
    </script>
  </body>
</html>
 
     
     
     
     
     
    