Js fundamentals reference vs copy The most common pitfall in js is probably due to not understanding the difference between primitive types and objects. TL:DR; arrays and objects are referenced, to make copies use either of the methods slice,concat,[...],Assign,{...}