http://stackoverflow.com/questions/5...ociative-array

la + facile
Codice PHP:
var element_count 0;
for(var 
e in car) {
    if(
car.hasOwnProperty(e)){
        
element_count++; 
    }
}
alert(element_count); 
con prototype

Codice PHP:
Object.prototype.size = function () {
  var 
len0;
  for(var 
e in this) {
    if(
this.hasOwnProperty(e)){
          
len++;
    }
  }
  return 
len;
}
alert(car.size()); 




PS
Benvenuto nel forum
e ricordati che gli array associativi in js
sono oggetti