Home » jQuery22 January 2010

jQuery: Print array and object

This article shows how to print array and object on jQuery. You can do it with jQuery.each() function.

jQuery.each() function can be used to iterate over any collection, whether it is a map (JavaScript object) or an array.

Here is the javascript code to print array or object:

Here, arr is a numeric array. Its key and value are printed in the div with id arrData. Similarly, obj is an associative array or object. Its key and value are printed in the div with id objData.

Here is the full source code:

Thanks.

jQuery

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • This is fantastic, I use these bits of code all the time. I just wanted to say thanks for the help!

  • Its useful. Thanks