刚开始学习学习,求老哥们指点
javascript吧
全部回复
仅看楼主
level 3
Akin阿金
楼主
为什么初始数组时,它把我的数字判成了字符,因此还输出了逗号,逗号不是分割用的吗?
2022年01月11日 13点01分
1
level 3
.闪烁之光
因为name
2022年01月11日 14点01分
2
level 12
白き永遠
<script>标签写在<body>里试试
2022年01月11日 14点01分
3
level 1
物依旧人已非aa
换一个变量名,不要用name,那是js的关键字之一。
2022年01月11日 15点01分
4
level 1
月半木登🍑
不要用name作为变量名,你用typeof验证一下就知道了
2022年01月12日 14点01分
5
月半木登🍑
他不是关键字也不是保留字,但他是全局属性
2022年01月12日 14点01分
Akin阿金
@月半木登🍑
感谢老哥
2022年01月13日 02点01分
level 12
丶影-奈斯
// window有name 值始终是字符串(可以换个变量名或用es6的let或const(不会向window注册属性))
const name = [1, 2, 3, 4, 5];
for (let i = 0, l = name.length; i < l; i++) {
alert(name[i]);
}
2022年01月13日 00点01分
6
Akin阿金
感谢老哥
2022年01月13日 02点01分
1