开发者

Difference between functions and function literals in ActionScript 3?

What is the difference between the following two function definitions in ActionScript 3?

f = function(arg) {
  // body
}

开发者_StackOverflowand

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜