开发者

Is there a naming convention for javascript variables that hold functions?

setup: function (baseUrl, d开发者_C百科evModeCheck) {

where devModeCheck is a function that will be called.

Is there any commonly-used naming convention in javascript that makes this intention obvious?

devModeCheckFunc and fDevModeCheck both seem kind-of horrible.


callback is a pretty common naming convention. For simpler higher order functions it holds well, but if you write more complicated code it may not be that simple (like if you have several callbacks).

As with naming anything in code, make the intent clear on what something is. callback may be too generic in some instances, or it may be too specific in others.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜