Is there a short way of declaring an associative array like in PHP?
$myArray = array(\'a\' => \'b\'); // PHP Way
In JavaScript I\'d do i
Declare an object like this:
var myArray = {"a": "b", "c": "d"};
... and then refer to each item like this:
var somethingElse = myArray["a"]; //Sets "somethingElse" to "b".
As @Chris and @Marc mention in the comments: in JavaScript, objects ARE associative arrays, and vice versa, they just refer to two different ways of doing the same thing. For Example...
var somethingElse = myArray["a"];
var anotherVariable = myArray.a;
... do the same thing.