What's the difference between function A () {} and var A = function A () {}

What"s the difference between

function A () {} and var A = function A () {}.

Mar.05,2021

1.function A () {} is the function declaration
2.var A = function A () {} is an expression, assigning a reference to function A to a variable A
1 has the problem of declaring promotion while 2 will not.


 
function A() {}


var A = function() {};


var A = function A() {};



Menu