我正在使用Javascript for Kids,对于初学者来说这是一本非常有趣的小书,但我在测试文本中的For循环示例时遇到了问题:
var sheepCounted = 0;
for (var sheepCounted = 0; sheepCounted < 10; sheepCounted++) {
console.log(“I have counted” + sheepCounted + “sheep!”);
}
console.log(sheepCounted);
当我使用Javascript测试器测试此示例时,我收到语法错误,但我不确定为什么?谁能帮我吗?谢谢。
更改使用“ ”
的这一行:
console.log(“I have counted” + sheepCounted + “sheep!”);
与" "
对此:
console.log("I have counted" + sheepCounted + "sheep!");