Useful notes & manuals
from the
world wide web
Register now!
Merging JavaScript objects JavaScript
Solution from: Created by tlw on 25.02.2024 @ 16:13

for (attrname in obj2)
    obj1[attrname] = obj2[attrname];

If you're using a framework that shits all over your prototypes then you have to get fancier with checks like hasOwnProperty, but that code will work for 99% of cases.

javascript   object   oop   json   merge   join
Created by THE LOST WEB © 2009-2012