Computer >> Computer tutorials >  >> Programming >> Javascript

What is function() constructor in JavaScript?


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>