uvinod uvinod - 1 year ago 151
Javascript Question

How to print object array in javascript?

I have created an object array in javascript. My question is how to print the object array in the browser window like print_r function in php. Thanks advance.

var lineChartData = [{
date: new Date(2009, 10, 2),
value: 5
}, {
date: new Date(2009, 10, 25),
value: 30
}, {
date: new Date(2009, 10, 26),
value: 72,
customBullet: "images/redstar.png"

Answer Source

There is a wonderful print_r implementation for JavaScript in php.js library.

Note, you should also add echo support in the code.

DEMO: http://jsbin.com/esexiw/1

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download