【发布时间】:2013-07-26 06:00:32
【问题描述】:
所以我试图将数组的长度作为字符串推送到另一个数组上。 我的逻辑是……对于 javascript
if x = [1];
and y = [1];
我想在 for 循环中将 x.length + 1 推送到 y 数组,这样它就变成了 1 12 123 第1234章
这就是我正在尝试的方式,但得到了阅读
function push() { [native code] } function push() { [native code] } function push() { [native code] } function push() { [native code] }
这是我的代码
for (i=0; i < 100; i++) {
var x = [1];
var y = [1];
document.writeln(y.push.toString(x.length + 1));
};
这是逻辑错误还是语法错误?
【问题讨论】:
-
你希望
y.push.toString做什么?
标签: javascript for-loop syntax logic