There is a great library called underscore (http://underscorejs.org), please look at _.extend(), it will copy object properties for you.