我正在写一个Javascript函数,它可以处理一个即时写入并作为参数发送的数组。Javascript函数编程 - 接收精心设计的参数
function returnJourney(animation,clean){
var properties = {};
// loads of other inane stuff
for(i in animation[0]) properties[animation[0][i]] = animation[0].i;
// heaps more inane stuff
}
在考虑中的动画是一组用于一个jQuery动画参数:
该函数如下写入。通常采用格式({key:value,key:value},speedAsInteger,modifierAsString)
。
因此揭开序幕初始调试我把它用:
returnJouney(({'foo':'bar'},3000),1);
直蝙蝠事情路要走。据我所知,这将有returnJourney确认clean === 1
和animation
是一个数组,其中第一个孩子的对象和第二个数字3000。
Firebug告诉我animation
求值为3000.我在做什么错了?
感谢鲍勃,只需要一个数组语法刷新:) – Barney 2010-03-28 14:47:15