JQuery Error Message invalid arrow-functions arguments

Posted on

This is another article written to discuss an error message triggered upon executing a web page with a JQuery snippet code inside of it. As shown in the title of this article the error message which is shown is ‘invalid arrow-functions arguments’. The error message itself is actually retrieved from a display of firebug plugin added and installed in Mozilla Web Browser.

The plugin named firebug is actually quite a useful tool for debugging and displaying error message upon executing JQuery snippet code which can be shown in the following image :

JQuery Error Message invalid arrow-functions arguments
JQuery Error Message invalid arrow-functions arguments

The actual error message displayed is shown in detail below :

var db_list = new Array("1"=>"PostgreSQL","2"=>"MySQL","3"=>"Microsoft SQL Server");

The JQuery snippet code as shown above is actually triggering the error stated in the title of the article. The error itself has connection with another article which is also has the same problem but different error message. The article is titled ‘JQuery Error Message expected expression got ‘>’‘ which can be visited in the following link.

The error message itself is caused because of the sign  “=>” since it is clearly stated that the error message is “invalid arrow-functions arguments”. The solution itself which is used to solve the problem and handle the error message is actually the same with the one stated in the article ‘JQuery Error Message expected expression got ‘>’‘ which can be visited in the following link.

It is about declaring an array associative variable in a right way. So, in order to solve the problem and handle the error message, below is the snippet code used to correctly define array associative variable as follows :

var db_list = {"1":"PostgreSQL","2":"MySQL","3":"Microsoft SQL Server"};

The above is one way to correctly define or declare an associative array variable which is inserted in a ‘<script>’ tag. It is specifically assign with attribute which is stating that the script is a Javascript scripting as follows :

<script type=”text/javascript”>

So, in the above array associative variable declared, there are several entities where the key and the value must be separated with “:”. It is not necessary to use Array class and then instantiated into an Array object which is passed to the variable. So, just define it as shown in the above declaration.

Leave a Reply