What is function() constructor in JavaScript?

JavascriptWeb DevelopmentFront End Technology

The function() constructor is used in JavaScript to create a new function object. The objects created are parsed when the function is created.

Example

You can try to run the following code to learn how to work with function() constructor

Live Demo

<html>
   <body>
      <script>
         var num = new Function('p', 'q', 'r', 'return p * q * r');
         document.write("Value after multiplication: "+num(5, 2, 9));
      </script>
   </body>
</html>
raja
Published on 25-Jan-2018 16:08:11
Advertisements