Javascript语法错误意外标记非法

Javascript语法错误意外标记非法,javascript,syntax,syntax-error,token,Javascript,Syntax,Syntax Error,Token,我在Google chrome上的Javascript控制台上遇到了一个语法错误。有什么想法吗?你必须关闭每一行的引号,并用+连接到下一行: function queue_instructions(){ var input_message = "Commands w? Shows whos on the waitlist w+ Adds yourself to the waitlist w- Removes yourself from the wai

我在Google chrome上的Javascript控制台上遇到了一个语法错误。有什么想法吗?

你必须关闭每一行的引号,并用
+
连接到下一行:

function queue_instructions(){
        var input_message = "Commands
    w?  Shows whos on the waitlist
    w+  Adds yourself to the waitlist
    w-  Removes yourself from the waitlist
    w++  Moves yourself down one spot on the waitlist
    -mods  Shows a list of available moderators
    -plays  Shows how many songs each DJ has played
    -promote  Requests a vote from everyone for you to be moved to 1st on the list
    -pull [#]  Requests a vote from everyone to pull that DJ off the booth  Number of DJ is     what number spot he is on the booth  Numbers read from left to right
    -remove [#]  Removes that number DJ from the waitlist  Must be a moderator
    -votekick [username]  Requests a vote from everyone to kick the user
     Type -help [command] for more info on a command (ie. -help w?)";
        deliver_chat(input_message);
等等

是否希望每行都插入换行符?如果是这样,您可以使用
\n

var input_message = "Commands " + 
    "w?  Shows whos on the waitlist " + 
    "w+  Adds yourself to the waitlist " + 

您必须关闭每行上的引号,并用
+
连接到下一行:

function queue_instructions(){
        var input_message = "Commands
    w?  Shows whos on the waitlist
    w+  Adds yourself to the waitlist
    w-  Removes yourself from the waitlist
    w++  Moves yourself down one spot on the waitlist
    -mods  Shows a list of available moderators
    -plays  Shows how many songs each DJ has played
    -promote  Requests a vote from everyone for you to be moved to 1st on the list
    -pull [#]  Requests a vote from everyone to pull that DJ off the booth  Number of DJ is     what number spot he is on the booth  Numbers read from left to right
    -remove [#]  Removes that number DJ from the waitlist  Must be a moderator
    -votekick [username]  Requests a vote from everyone to kick the user
     Type -help [command] for more info on a command (ie. -help w?)";
        deliver_chat(input_message);
等等

是否希望每行都插入换行符?如果是这样,您可以使用
\n

var input_message = "Commands " + 
    "w?  Shows whos on the waitlist " + 
    "w+  Adds yourself to the waitlist " + 

你的语法不正确。您需要将整个字符串放在一行中,或者关闭每行中的引号a do a+以连接下一行。

您的语法不正确。您需要将整个字符串放在一行中,或者关闭每行中的引号,并使用do a+连接下一行。

将字符串拆分为多行时,需要将其与
+
连接起来,如下所示

var input_message = "Commands\n" + 
    "w?  Shows whos on the waitlist\n" + 
    "w+  Adds yourself to the waitlist\n" + 

同样在你的代码中,我找不到该函数的右大括号
}

var input_message = "Commands"+
"w?  Shows whos on the waitlist"+
"w+  Adds yourself to the waitlist"+
"w-  Removes yourself from the waitlist"+
"w++  Moves yourself down one spot on the waitlist"+
"-mods  Shows a list of available moderators"+
"-plays  Shows how many songs each DJ has played"+;

您需要包含它。

当您在多行上拆分字符串时,您需要像这样将其与
+
连接起来

var input_message = "Commands\n" + 
    "w?  Shows whos on the waitlist\n" + 
    "w+  Adds yourself to the waitlist\n" + 

同样在你的代码中,我找不到该函数的右大括号
}

var input_message = "Commands"+
"w?  Shows whos on the waitlist"+
"w+  Adds yourself to the waitlist"+
"w-  Removes yourself from the waitlist"+
"w++  Moves yourself down one spot on the waitlist"+
"-mods  Shows a list of available moderators"+
"-plays  Shows how many songs each DJ has played"+;
您需要包括它。

或者您可以这样做:

function queue_instructions()
{
     //Stuff here.
}
或者你喜欢这样:

function queue_instructions()
{
     //Stuff here.
}

我注意到没有人建议跳过这行结尾:

var input_message = [
    "Commands",
    "w?  Shows whos on the waitlist",
    "w+  Adds yourself to the waitlist",
    "w-  Removes yourself from the waitlist",
    "w++  Moves yourself down one spot on the waitlist",
    "-mods  Shows a list of available moderators",
    "-plays  Shows how many songs each DJ has played",
    "-promote  Requests a vote from everyone for you to be moved to 1st on the list",
    "-pull [#]  Requests a vote from everyone to pull that DJ off the booth  Number of DJ is what number spot he is on the booth  Numbers read from left to right",
    "-remove [#]  Removes that number DJ from the waitlist  Must be a moderator",
    "-votekick [username]  Requests a vote from everyone to kick the user",
    "Type -help [command] for more info on a command (ie. -help w?)"
].join("\n");
请注意,行尾包含在该字符串中


我注意到没有人建议跳过这行结尾:

var input_message = [
    "Commands",
    "w?  Shows whos on the waitlist",
    "w+  Adds yourself to the waitlist",
    "w-  Removes yourself from the waitlist",
    "w++  Moves yourself down one spot on the waitlist",
    "-mods  Shows a list of available moderators",
    "-plays  Shows how many songs each DJ has played",
    "-promote  Requests a vote from everyone for you to be moved to 1st on the list",
    "-pull [#]  Requests a vote from everyone to pull that DJ off the booth  Number of DJ is what number spot he is on the booth  Numbers read from left to right",
    "-remove [#]  Removes that number DJ from the waitlist  Must be a moderator",
    "-votekick [username]  Requests a vote from everyone to kick the user",
    "Type -help [command] for more info on a command (ie. -help w?)"
].join("\n");
请注意,行尾包含在该字符串中


是你花时间编辑这个问题的,所以a+1是我能做的最起码的:)是你花时间编辑这个问题的,所以a+1是我能做的最起码的:)