0

Whats Difference b/w named and anonymous function??

let abc = function (a,b){ return a+b ; }; document.write(abc(2,3)) function add (a,b){ return a+b ; }; document.write(abc(2,3)) There is literally no difference, all same with same answers

16th Oct 2020, 10:52 AM
G. Yaseen
G. Yaseen - avatar
1 Answer
+ 4
Anonymous function declarations are not candidates for variable hoisting. This will work 👇 abc(2); function abc(n) {} This won't work abc(2); let abc = function (n) {} // cannot access abc before declaration https://developer.mozilla.org/en-US/docs/Glossary/Hoisting
16th Oct 2020, 10:58 AM
Ore
Ore - avatar