DEV Community

Sagar Gnawali
Sagar Gnawali

Posted on

Day 3 -> 40 days of code.

Anonymous function
In general we can say that the function which haven't any name are known as anonymous function.
Let's see what does it mean
General function have their function name
eg.
function printdata ()
{
console.log('general function');
}
printdata();

On The other hand we have anonymous function which haven't any name.In JavaScript we store function in some variable name which is known as anonymous function.
eg.
const printdata = function()
{
console.log('Anonymous function');
}
printdata();

Usage:

  • Anonymous function are passed as an argument to other function.

And if you have unconventional output don't be afraid of it.
This is the first step to learn something new.
Sometimes unconventional code/output brings great idea to solve bugs.

Top comments (0)