Strict mode- same parameter:- genius student


  • You can place a program, or a function, in a "strict" operating context.
  • The strict mode does not allow duplicating a parameter name.

Code:-


  1. <!DOCTYPE html> 
  2. <html> 
  3.  
  4. <head> 
  5.  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  6. </head> 
  7.  
  8. <body> 
  9.  
  10.  <h1>"strict" function argument</h1> 
  11.  
  12.  <input type="button" onclick="fun_strict();" value="strict function"> 
  13.  <br/> 
  14.  <b>Note:</b> This example won't work because the function definition contain duplicate parameter in strict mode. 
  15.  <script> 
  16.   "use strict"; 
  17.  
  18.   function fun_strict(arg1, arg1) 
  19.   { 
  20.    alert("Hi"); //This won't work because in strict mode same parameter 
  21.   } 
  22.  </script> 
  23.  
  24. </body> 
  25.  
  26. </html>
Strict mode- same parameter:- genius student Strict mode- same parameter:- genius student Reviewed by Network security on November 04, 2019 Rating: 5

No comments:

Useful Information

Powered by Blogger.