Javascript数组[可能长度?]问题

时间:2011-11-15 12:26:31

标签: javascript

民间,

我有这个数组:

var list = new Array('Archer','Archer','Banker','Lantern','Toryboy','The Barb','Tim 
Whiffler','Glencoe','Warrior','Nimblefoot','The Pearl','The Quack','Don 
Juan','Haricot','Wollomai','Briseis','Chester','Calamia','Darriwell','Grand 
Flaneur','Zulu','The Assyrian','Martini-Henry','Malua','Sheet 
 Anchor','Arsenal','Dunlop','Mentor','Bravo','Carbine','Malvolio','Glenloth','Tarcoola','Pat
ron','Auraria','Newhaven','Gaulus','The Grafter','Merriwee','Clean 
Sweep','Revenue','The Victory','Lord Cardigan','Acrasia','Blue 
Spec','Poseidon','Apologue','Lord Nolan','Prince Foote','Comedy King','The 
Parisian','Piastre','Posinatus','Kingsburgh','Patrobas','Sasanof','Westcourt','Night 
Watch','Artilleryman','Poitrel','Sister Olive','King 
Ingoda','Bitalli','Backwood','Windbag','Spearfelt','Trivalve','Statesman','Nightmarch','Pha
r Lap','White Nose','Peter Pan','Hall Mark','Peter Pan','Marabou','Wotan','The 
Trump','Catalogue','Rivette','Old Rowley','Skipton','Colonus','Dark 
Felt','Sirius','Rainbird','Russia','Hiraji','Rimfire','Foxzami','Comic 
Court','Delta','Dalray','Wodalla','Rising Fast','Toparoa','Evening Peal','Straight 
Draw','Baystone','Macdougal','Hi Jinx','Lord Fury','Even Stevens','Gatum Gatum','Polo 
Prince','Light Fingers','Galilee','Red Handed','Rain Lover','Rain Lover','Baghdad 
Note','Silver Knight','Piping Lane','Gala Supreme','Think Big','Think Big','Van der 
Hum','Gold and Black','Arwon','Hyperno','Beldale Ball','Just A Dash','Gurner's 
Lane','Kiwi','Black Knight','What A Nuisance','At Talaq','Kensei','Empire 
Rose','Tawrrific','Kingston Rule','Lets Elope','Subzero','Vintage 
Crop','Jeune','Doriemus','Saintly','Might and Power','Jezabeel','Rogan 
Josh','Brew','Ethereal','Media Puzzle','Makybe Diva','Makybe Diva','Makybe 
Diva','Delta Blues','Efficient','Viewed','Shocking','Americain');

这是一个错误。我在多个浏览器中尝试过它。例如,Firefox Web Developer错误控制台在参数列表后面显示")"

谷歌Chrome表示未捕获的语法错误 - 意外的标识符,并且有趣地在列表中的俄罗斯(冷战阴谋论者?)之后进行格式更改。

2 个答案:

答案 0 :(得分:5)

您需要更改条目

'Gurner's Lane'

'Gurner\'s Lane'

"Gurner's Lane"

具有语法着色的IDE会使断开的引用变得明显(实际上就像SO突出显示一样)。

答案 1 :(得分:0)

你应该声明如下,以避免像这样的appostrophy错误     "x's"

var arlene2 = new Array("First element", "Second", "Last");

参考Declare an array in Javascript