Skip to content

Instantly share code, notes, and snippets.

View DaBs's full-sized avatar

David Alexander Bjerremose DaBs

View GitHub Profile
@wycliffepeart
wycliffepeart / merge-object.js
Last active December 8, 2020 03:32
Javascript Object.assign Alternative . The mergeObject() method is used to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object.
function mergeObject(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (source.hasOwnProperty(key)) {
target[key] = source[key];
}
}
}
return target;