More on Associative Array in Javascript

In this article about associative array, which looks similar to associative array in PHP. Here is some more ways for simulating associative array like things in Javascript:
<script type="text/javascript">
var obj = new Object();
obj['name'] = 'satya';
obj['sex'] = 'male';
obj['city'] = 'Patna';
obj['age'] = '30';
// this method is not working with Iterator.
obj.length = function () {
 for (var pair in obj) {
  if (typeof obj[pair] == 'function') continue;
 return ln;
These style also works as the above
//var obj = {"name":"satya", "age":30}; // Object
//var obj = ['lang', 'javascript']; // array
for (var i in obj) {
 if (typeof obj[i] == 'function') continue;
 alert(i + '=' + obj[i]); // name=satya for Obj and 0=lang for array

I have not explained anything in details. You can learn in detail about this associative array here.

Comments are open for an year period. Please, write here on Facebook page.