0

Can anyone explain to me the advantages of defining an anonymous function and assigning to a variable, contrary to defining by function name. Ie.

var add = function(a, b) { return a+b};
var result = add(1, 2);

Contrary to

function add(a, b) { return a+b };
var result = add(1, 2);

BTW I'm new to javascript but done a lot of C-style coding.

Best regards Ben

0 Answers0