109
rated 0 times
[
113]
[
4]
/ answers: 1 / hits: 33011
/ 10 Years ago, fri, march 21, 2014, 12:00:00
Is it possible to print / display a JavaScript variable's name? For example:
var foo=5;
var bar=6;
var foobar=foo+bar;
document.write(foo+ <br>);
document.write(bar+ <br>);
document.write(foobar + <br>);
How would we print the variable's names so the output would be:
foo
bar
foobar
Rather than:
5
6
11
More From » string