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);
我在 Google Chrome 上的 Javascript 控制台上收到语法错误意外 toke 非法。有什么想法吗?
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);
I get a syntax error unexpected toke illegal on my Javascript console on Google chrome. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您必须关闭每行上的这些引号,并使用
+
连接到下一行:依此类推
您是否希望在每行中插入换行符?如果是这样,您可以使用
\n
:You have to close those quotes on each line, and concatenate with
+
to the next line:and so on
Did you want line breaks to be inserted with each line? If so, you can use
\n
:当您将字符串拆分为多行时,您需要像这样用
+
连接它而且在您的代码中,我没有找到它的右大括号
}
功能。你需要包含它。
When you split a string over multiple lines, you need to concatenate it with
+
like thisAnd also in your code, I don't find the closing curly brace
}
of that function.you need to include it.
你的语法不正确。您需要将整个字符串放在一行中,或者关闭每行中的引号,并使用 + 将下一行与其连接。
Your syntax is incorrect. You'll need to either put the whole string in one line OR close the quotes in each line a do a + to concat the next line with it.
或者你这样做:
Or you do like this:
我注意到没有人建议转义行结尾:
请注意,行结尾包含在此字符串中...
http ://davidwalsh.name/multiline-javascript-strings
I notice no-one has suggested escaping the line-ending:
Note that the line endings are included in this string…
http://davidwalsh.name/multiline-javascript-strings