Equivalent of Python's locals()?
Python's locals() function, when called within the scope of a function,
returns a dictionary whose key-value pairs are the names and values of the
function's local variables. For example:
def menu():
spam = 3
ham = 9
eggs = 5
return locals()
print menu() # {'eggs': 5, 'ham': 9, 'spam': 3}
Does JavaScript have anything like this?
No comments:
Post a Comment