 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
When to use anonymous JavaScript functions?
The code while using anonymous functions is more readable when handlers are to be defined inside the calling code. Anonymous functions are declared inline. Normally, inline functions are better since they can access variables in the parent scopes.
It allows for creating a function without any names identifier. It can be used as an argument to other functions. You can call them using a variable name.
This is how JavaScript anonymous functions can be used −
var func = function() {    alert(‘This is anonymous'); } func(); Here’s an example −
//anonymous function var a = function() {    return 5; }Advertisements
 