Javascript 语法错误意外令牌非法 [英] Javascript syntax error unexpected token illegal

查看:43
本文介绍了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 控制台上收到语法错误意外令牌非法.有什么想法吗?

I get a syntax error unexpected toke illegal on my Javascript console on Google chrome. Any ideas?

推荐答案

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

You have to close those quotes on each line, and concatenate with + to the next line:

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

等等

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

Did you want line breaks to be inserted with each line? If so, you can use \n:

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

这篇关于Javascript 语法错误意外令牌非法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆