2015-05-25 35 views
-11
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!") 

} 

爲什麼這是意想不到的標識符?語法錯誤意外標識符有什麼問題?

+0

這不是Java – chokdee

+6

我希望你沒寫'小於'。 – Maroun

回答

3

此:

if(age is less than 13) 

必須改變,以

if(age < 13) 

is less than不是JavaScript的一個有效的語法。

+0

即使使用COBOL <而不是IS-LESS-THAN! – MortimerCat

0

這不是我們如何把我們的邏輯,從簡單的英語代碼語言...您使用英語小於

而是用什麼編譯器會理解只是將其更改爲以下語法

if(age < 13) 

而你完成了

相關問題