jQuery/JavaScript var_dump PHP equivalent

/, JavaScript, jQuery/jQuery/JavaScript var_dump PHP equivalent

jQuery/JavaScript var_dump PHP equivalent

Sometimes you have objects you need to see visually.. This is one little function/method of doing that with JavaScript.\r\n\r\n
\r\nfunction dumpVars(obj, inAlert) {\r\n    var out = '';\r\n    for (var i in obj) {\r\n        out += i + ": " + obj[i] + "\n";\r\n    }\r\n\r\n    if(inAlert){alert(out);}\r\n    else\r\n    {\r\n         var pre = document.createElement('pre');\r\n         pre.innerHTML = out;\r\n         document.body.appendChild(pre)\r\n    }\r\n}\r\n
By |2014-01-05T10:18:35+00:00June 7th, 2012|Code, JavaScript, jQuery|0 Comments

About the Author:

Not much to know about me, I'm a 35+ year old coder, geek, gamer..

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: