【发布时间】:2013-01-08 21:52:07
【问题描述】:
我有一个名为loopNum 的变量,它在控制台中作为对象返回。其他变量按预期返回。谁能解释为什么会这样?谢谢
脚本
// stores how many carousels there are
var carouselNum = $('.carousella').length;
// stores the product of number of carousels times the increment value
var loopNum = $((carouselNum - 2) * -183);
console.log('loopNum = ' + loopNum);
console.log('carouselNum = ' + carouselNum);
控制台
loopNum = [object Object]
【问题讨论】:
-
你为什么要传递 jQuery
$你的计算结果? -
你为什么要把
$(...)包裹在数字周围??? -
@thesystem 在这里太棒了:-)
-
@thesystem, I don't think he's using enough jQuery at all.
-
@zzzzBov:嘿,这很有趣。 :)
标签: javascript jquery variables object