开发者

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

开发者 https://www.devze.com 2023-02-28 14:23 出处:网络
setup: function (baseUrl, d开发者_C百科evModeCheck) { where devModeCheck is a function that will be called.
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

精彩评论

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