EN
JavaScript - equivalent of var_dump or print_r in PHP?
1
answers
0
points
I've created an object in JavaScript and I would like to see its methods/fields for debugging.
Is there anything similar to var_dump
in PHP?
1 answer
0
points
Use console.log()
method that outputs a message to the web console.
However, to display objects in the console you will also need convert them to the string first using JSON.stringify()
method.
Practical example
// ONLINE-RUNNER:browser;
var object = { id: 1, name: 'Tom' };
console.log(JSON.stringify(object));
See also
References
0 comments
Add comment