+ 1
What is the difference between function declaration and function definition in javascript? Can we have one example for the same?
1 Odpowiedź
+ 2
In JS, there is no "declaration" of function distinct from "definition", as you do in C, Java...
So there's no difference.
Otherwise, in JS, we distinct function "declarations" from function "expressions" ( "function fn() { }" vs "var fn = function() { };" ), and the term "definition" usually stand for both ( as well, both variable declarations and initialisations are called "variable definitions" ).