![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What does a +function() { } notation do in JavaScript?
The +function() {} notation is primarily used to force the parser to treat whatever follows the + as an expression. This is used for functions that are invoked immediately, for example,
+function() { alert("Demo!"); }();
However, + before a function is one of the symbol. You can add other options also like !, -, ~, also.
Parentheses can also be used as shown below:
(function() { alert("Demo!"); })();
You can also use it like this:
(function() { alert("Demo!"); }());
Advertisements