Skip to main content

Timeline for Print a Variable's Name

Current License: CC BY-SA 3.0

14 events
when toggle format what by license comment
Jun 17, 2020 at 9:04 history edited CommunityBot
Commonmark migration
Jun 23, 2017 at 10:13 history edited Shaggy CC BY-SA 3.0
added 166 characters in body
Jun 16, 2017 at 16:53 comment added darrylyeo Here's my JavaScript attempt.
Jun 14, 2017 at 17:44 history edited Shaggy CC BY-SA 3.0
added 268 characters in body
Jun 14, 2017 at 15:01 comment added Olivier Dulac @CalebKleveter : I have no idea if it is relevant here (I haven't started learning javascript yet) but maybe top-javascript-pitfalls can help?
Jun 14, 2017 at 14:55 history edited Shaggy CC BY-SA 3.0
added 193 characters in body
Jun 14, 2017 at 14:53 comment added Shaggy @CalebKleveter, see here for more info on the difference in scoping between let and var. To your second question: That happened because you have a variable named IN_GLOBAL_SCOPE within your global scope and it has a value of 1. You can check the existing variables in your global scope and their values by running this before testing the above: for(x in this)console.log(x+": "+this[x])
Jun 14, 2017 at 14:12 comment added Caleb Kleveter Why does let not work? And I am rather confused about what caused the output from the google var.
Jun 14, 2017 at 14:10 comment added Shaggy @CalebKleveter; some of those are due to the fact that the value of the variable you're passing isn't unique to that variable and some of it is due to invalid variable names (e.g., hello--). Also, you'd need to use var rather than let.
Jun 14, 2017 at 14:05 comment added Shaggy @MartinEnder; yes, it assumes that the value assigned to the variable passed is unique to that variable; forgot to include that when I posted.
Jun 14, 2017 at 14:03 history edited Shaggy CC BY-SA 3.0
added 604 characters in body
Jun 14, 2017 at 13:55 comment added Caleb Kleveter I am getting some very weird output.
Jun 14, 2017 at 13:52 comment added Martin Ender I think this fails if two globals have the same value.
Jun 14, 2017 at 13:50 history answered Shaggy CC BY-SA 3.0