哪个没有语法错误?我想知道这 4 个中哪一个没有语法错误
alert("hello "+3+" times);
alert("hello "+3 times);
alert("hello +3+ times");
alert("hello "+3 +" times);
哪个没有语法错误?我想知道这 4 个中哪一个没有语法错误
alert("hello "+3+" times);
alert("hello "+3 times);
alert("hello +3+ times");
alert("hello "+3 +" times);
第三个。原因是其他人没有在字符串周围使用成对的引号。对于测试,你可以使用这个:
alert("hello +3+ times");
对于测试,你可以尝试这样的东西......(单独)。所有在同一个脚本中它不会解析:
alert("hello "+1+" times);
alert("hello "+2 times);
alert("hello +3+ times");
alert("hello "+4 +" times);
alert("hello "+5+" times");
alert("hello " + 6 + " times");
alert("hello "+3+" times); // missing a closing doublequote
alert("hello "+3 times); // missing both doublequotes around strings
alert("hello +3+ times"); // this has no syntax error, just will alert the string literal
alert("hello "+3 +" times); // missing closing doublequotes