【发布时间】:2012-08-02 07:01:29
【问题描述】:
有没有办法像在 Python 中一样在 Javascript/jQuery 中声明范围?
类似这样的:
x = 范围(1,10)
x = [1,2,3,4,5,6,7,8,9]
谢谢。
【问题讨论】:
-
为了好玩试试:
function r(start,end){ start = start || 1; return end >= start ? r(start,end-1).concat(end) : []; }
标签: javascript jquery arrays