The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
A tiny Javascript help
I need a way to view all varibles even if I dont know the name of each one in Javascript.
Something like var_dump in php. |
#2
|
||||
|
||||
Code:
function var_dump(obj) { if(typeof obj == "object") { return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "")+"\nValue: " + obj; } else { return "Type: "+typeof(obj)+"\nValue: "+obj; } } |
#3
|
||||
|
||||
Quote:
I get "Type: object Value: [object] ". |
#4
|
||||
|
||||
That's a standard php var_dump simulator for javascript that can be found a million places on the net. It simulates var dump which does not give you all variable values. Only the one you use the function on.
|
#5
|
||||
|
||||
Quote:
|
#6
|
||||
|
||||
Are you trying to find all objects are see if a particular object is defined?
|
#7
|
||||
|
||||
Trying to see all objects to a varible.
|
#8
|
||||
|
||||
I'm not sure I understand what it is you want to do.
|
#9
|
||||
|
||||
I have 'this.****' I want to find out what everything that is in it and named.
|
#10
|
||||
|
||||
Then just use the code above.
var_dump(this.varname); |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|