[英]Uncaught SyntaxError: Unexpected token ( error in Javascript
[英]Javascript “Uncaught SyntaxError: Unexpected token ;” error
當我運行此代碼時,它在Chrome中給出了語法錯誤。
var leanboo = confirm("RFT(ready for testing)?") // Co1,Cr1
console.log(leanboo)
var text = prompt("What are your thoughts of this Area?")
console.log(text)
function crashCourseTesterIdGenerator(min, max) {
console.log(Math.floor((Math.random() * max) + min);)
} //Co1,Cr2
var testermin = prompt("Id generating min:")
var testermax = prompt("Id generating max:")
console.log(crashCourseTesterIdGenerator(testermin, testermax))
它與方法名稱的長度有關還是我只是忘記了一些分號?
你有一個;
里面 console.log()
在函數中調用。
var leanboo = confirm("RFT(ready for testing)?"); // Co1,Cr1
console.log(leanboo);
var text = prompt("What are your thoughts of this Area?");
console.log(text);
function crashCourseTesterIdGenerator(min, max) {
console.log(Math.floor((Math.random() * max) + min));
} //Co1,Cr2
var testermin = prompt("Id generating min:");
var testermax = prompt("Id generating max:");
console.log(crashCourseTesterIdGenerator(testermin, testermax));
應該修復你吧。
半冒號位於Javascript中每個語句的末尾。 你想念他們。
並非嚴格要求使用它們,但是如果Javascript不知道一條語句何時結束而另一條語句開始,則沒有它們就可以提交各種難以發現的錯誤。 最好始終使用它們是一項私法問題,您將來自己會節省很多調試時間。
然后又有一個:
console.log(Math.floor((Math.random() * max) + min);)
在行尾之前。 這實際上是導致錯誤消息的原因。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.