【发布时间】:2017-02-09 06:42:39
【问题描述】:
js 上的新功能,代码如下。在这里我无法打印正确的结果。我认为+ "names[i]"这部分代码有问题。
var names = ["aha","mk", "jk","hk","fhf"];
for (i=1;i<=names.length;i++){
console.log("I know someone called "+ "names[i]");
}
【问题讨论】:
-
不要为
names[i]使用引号。这样做console.log("I know someone called "+ names[i]); -
引号仅用于字符串,数组不需要它们
标签: javascript php jquery angularjs