This is an article discussing on an error message triggered based on the execution of a web page where there is a JQuery snippet code inserted in it. So, the error message is actually generated from the execution of JQuery snippet code. The error message is actually defined as the title of this article which is ‘expected expression got ‘>’. The actual error message can be seen in the following image shown below :
The error which is shown above in form of an image is actually triggered from a certain snippet code shown below :
var db_list = new Array("1"->"PostgreSQL,"2"->"MySQL", "3"->"Microsoft SQL Server");
The above snippet code is actually made for declaring a variable named as an array variable. But the way for declaring the array variable is totally wrong and it generally triggers an error “expected expression got ‘>’”. So, the problem is the ‘>’ sign which is defined in the array variable.
It is an error which is retrieved from a tool installed as an additional plugin in a Mozilla Web Browser named Firebug. By installing and displaying it, the error which is generated upon the execution of a JQuery snippet code where there is a certain error as shown above.
And to correct the declaration of the above variable named db_list, it doesn’t need an additional definition of creating instance of Array and pass it to the variable declared. In this context, the aim is to create an associative array variable, so the correct one to define it as an associate array variable is shown below :
var db_list = {"1":"PostgreSQL","2":"MySQL","3":"Microsoft SQL Server"};
So, the above snippet code is actually the correct one for defining an associative array variable. The associative array variable above is the correct one where the key and the value is separated with a specific sign. It is not the ‘>’ but the sign “:”. Furthermore, to separate between an entity of pair associative array key and value, it is done by following it with a comma as shown above.
One thought on “JQuery Error Message expected expression got ‘>’”