Display key-value pair of associative array in Javascript with jQuery

Useful snippet for debugging javascript. It prints out key-value pairs of associative array. In PHP your have function print_r($array), but in Javascript you still have to make your own function.
$.each(myAssociativeArr, function (idx, obj) { $.each(this, function(key, val){ console.log(key, val) }) })
You can fill associative array, for example, this way:
//Initialize array in Javascript var myAssociativeArr = []; //Add element to array myAssociativeArr.push( { id: 1, title: "my title 1", url: "http://url1", css: "myCssClass1", txtdescription: "my text description 1" }); myAssociativeArr.push( { id: 2, title: "my title 2", url: "http://url2", css: "myCssClass2", txtdescription: "my text description 2" });