匿名函数的应用
(1)将一个匿名函数保存在变量中
var sayName = function(){ ???console.log(‘sayName function‘);}(2)将一个匿名函数保存在对象的方法中
var person = { ???sayName: function(){ ???????console.log(‘sayName‘); ???}}(3)将一个匿名函数作为回调函数
setTimeout(function(){ ???console.log(‘hello world‘);}, 1000);JS--匿名函数
原文地址:https://www.cnblogs.com/marton/p/10269573.html