2011-12-23 23 views
0
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コンソールで予期しない構文エラーが発生しました。何か案は?あなたは、各ライン上にこれらの引用符を閉じて、次の行に+で連結する必要がJavascriptの構文エラーが予期しないトークンが無効

答えて

3

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

ので、あなたは行が各ラインに挿入されることを壊したかったですか?その場合は\nを使用できます。

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

構文が正しくありません。文字列全体を1行に入れるか、各行の引用符を閉じて次の行に連結する必要があります。

1

あなたは複数行にわたる文字列を分割すると、あなたのコード内でこの

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. 
} 

あなたはそれを含める必要があります。

+1

この質問を編集する時間がかかりましたので、+1 i私はできることは少なくともです:) –

0

それとも、このように行います...

行末がこの文字列に含まれていることを

var multiStr = "This is the first line \ 
    This is the second line \ 
    This is more..."; 

注:

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"); 
関連する問題