Why i get error "SyntaxError: illegal character"

Alex N picture Alex N · Sep 10, 2013 · Viewed 13.7k times · Source

If I use line:

var colorsone = ["#F0F8FF", "#FAEBD7", "#00FFFF", #7FFFD4", #F0FFFF","#F5F5DC", "#FFE4C4", "#000000", "#FFEBCD", "#0000FF", "#8A2BE2", "#A52A2A", "#DEB887", "#5F9EA0", "#7FFF00", "#D2691E", "#FF7F50", "#6495ED", "#FFF8DC", "#DC143C", "#00FFFF", "#00008B", "#008B8B", "#B8860B", "#A9A9A9", "#006400", "#BDB76B", "#8B008B"];

I get this error in firebug

SyntaxError: illegal character
...one = ["#F0F8FF", "#FAEBD7", "#00FFFF", #7FFFD4", #F0FFFF","#F5F5DC", "#FFE4C4",...
jquery....min.js (строка 6, столбец 50)

I am using jquery 1.10.2

Tell me please why i get error?

Answer

naththedeveloper picture naththedeveloper · Sep 10, 2013

You have missing quote marks in your array.

var colorsone = ["#F0F8FF", "#FAEBD7", "#00FFFF", #7FFFD4", #F0FFFF","#F5F5DC"
                                                 ^ here    ^ and here