I'm struggling to see the differences and benefits between defining a function as a variable vs just defining a function with a name. When would it be better to use each type?
Simple function definition
function add(a,b) {return a+b;};
// and calling it like this when you need it:
add(5,2) // Sum 7
vs
As a variable:
add = function(a,b) {return a+b;};
// and calling it like this when you need it:
add(5,2) // Sum 7
Apologies for the rookie question. Thanks!
Edited: typos