- You can place a program, or a function, in a "strict" operating context.
- The strict mode does not allow duplicating a parameter name.
Code:-
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- </head>
- <body>
- <h1>"strict" function argument</h1>
- <input type="button" onclick="fun_strict();" value="strict function">
- <br/>
- <b>Note:</b> This example won't work because the function definition contain duplicate parameter in strict mode.
- <script>
- "use strict";
- function fun_strict(arg1, arg1)
- {
- alert("Hi"); //This won't work because in strict mode same parameter
- }
- </script>
- </body>
- </html>
Strict mode- same parameter:- genius student
Reviewed by Network security
on
November 04, 2019
Rating:
No comments: