Javascript 语法错误意外标识符what';怎么了?
为什么这是意外的标识符?这是:Javascript 语法错误意外标识符what';怎么了?,javascript,Javascript,为什么这是意外的标识符?这是: confirm("are you ready to play") var age = prompt("What's your age"); if(age is less than 13) { console.log("You are allowed to play but I take no responsibility") } else { console.log("You will feel honored to play this
confirm("are you ready to play")
var age = prompt("What's your age");
if(age is less than 13) {
console.log("You are allowed to play but I take no responsibility")
} else {
console.log("You will feel honored to play this game!")
}
必须改为
if(age is less than 13)
if(年龄<13岁)
小于
不是JavaScript的有效语法。这不是我们将逻辑从简单英语转换为代码语言的方式……您使用的英语少于
相反,使用编译器将理解的内容,只需将其更改为以下语法
if(age < 13)
if(年龄<13岁)
您已经完成了我希望您没有编写
小于
。即使是COBOL也使用了if(age < 13)