开发者

Point of putting a function in a var -JS [duplicate]

开发者 https://www.devze.com 2023-03-12 04:49 出处:网络
This question alre开发者_StackOverflow社区ady has answers here: Closed 11 years ago. Possible Duplicate:
This question alre开发者_StackOverflow社区ady has answers here: Closed 11 years ago.

Possible Duplicate:

Javascript: var functionName = function() {} vs function functionName() {}

What's the point of putting a function in a var or not?

var varFunc = function () {/*cool code*/};
function plainFunc() {
    /*cooler code?*/
}


Assigning a function to a variable, aka anonymous functions, can be pretty useful once you know what they do.

Check this out - http://helephant.com/2008/08/23/javascript-anonymous-functions/

0

精彩评论

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