How to define a JavaScript function using Function() Constructor?



The Function() constructor expects any number of string arguments. The last argument is the body of the function - it can contain arbitrary JavaScript statements, separated from each other by semicolons.

Example

You can try to run the following code to invoke a function with new Function Constructor −


   
      
   
   
      

Click the following button to call the function

     
               
   
Updated on: 2020-06-22T14:42:23+05:30

169 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements