Learning JS
# Passed by value or by reference?
Objects are passed by reference. Strings are too (I think).
# Comparing objects
If you compare them using ==
or ===
, you compare object references. If you want to compare the contents, use shallow comparison or deep comparison. There are probably functions in JS for that.