There are no "associative arrays" in JavaScript. It has arrays:
[1, 2, 3, 4, 5]
and objects:
{a: 1, b: 2, c: 3, d: 4, e: 5}
There are no "keys" in the array; they have indexes that are counted starting at 0.
Arrays are accessed using [], and objects can be accessed using []or ..
Example:
var array = [1,2,3];
array[1] = 4;
console.log(array);
var obj = {};
obj.test = 16;
obj['123'] = 24;
console.log(obj);
int, . , .
var array = [1,2,3];
array['test'] = 4;
console.log(array);
console.log(array.test);
jQuery $.each . $.each key , .
$.each([1, 2, 3, 4, 5], function(key, value){
console.log(key);
});
$.each({a: 1, b: 2, c: 3, d: 4, e: 5}, function(key, value){
console.log(key);
});