What is the difference between the following two function definitions in ActionScript 3?
f = function(arg) {
// body
}
function f(arg) {
// body
}
There is very little practical difference in the example you have provided. The difference is really at compile time. The one worth noting is that that in first case, f = function, you can redefine the value of f at anytime, while in the second case, redefining f would cause a compiler error.
General best practices is to use the second.
Hope that helps.
精彩评论