In the previous example, we called the anonymous function without any argument. But in this function we are passed two(a, b) arugments.
Code:-
- <html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <script>
- (function(a, b)
- {
- alert("a is : " + a);
- alert("b is : " + b);
- })(30, 60);
- </script>
- </head>
- <body>
- </body>
- </html>
Immediately invoke function with argument:- JavaScript
Reviewed by Network security
on
November 13, 2019
Rating:
No comments: