I'm coming to Javascript from Python. In Python if you use a list or dictionary as a default argument for a function, every call sees the same object. So if you have a function like:
def append_to_list(lst=[]):
lst.append(1)
return lst
and then call it like:
lst1 = append_to_list()
lst2 = append_to_list()
lst2
will have value [1, 1]
instead of just [1]
Does Javascript have the same issue with default arguments?