+ 2
Javascript Question
Why do we have to declare a JS function inside a variable? Eg: var a = function name() {} Can we not declare it like this? function name() {}
3 Respostas
+ 1
In first type you need not to mention name
Like
var a = function (){
}
. You can call it as a();
It's called annonymous function and more secure.
Second type is normal function you can call it as
name();
+ 4
Yup, u can do both.
+ 1
Divya Mohan Thanks!!