+ 2
4 ways to declare functions in JavaScript, which best one to use?
3 Respostas
+ 4
JavaScript code that forms the function body.
The list of parameters.
The variables accessible from the lexical scope.
The returned value.
+ 2
The statement function is best to use in javascript.
The most advantage of this type of function is that you can call a function statement before it is declared.
Ex:- you can do this like,
1) Function add(n1,n2){
//code
}
add(2,3);
or
2) add(2,3);
Function add(n1,n2){
//code
}
Both are accepted.
Hope you get it.
+ 1
I use the traditional way
function name(attr) {
// code
}