Object.assign >= 0.1.0

Purpose

Inject the enumerable properties of one object into another target object

Syntax

Object.assign ( ObjecttargetObjectfirstObjectsecondObject... );

Parameters

target

The target object that gets modified

first

second

...

Return values

Object

The `target` argument also gets returned

Examples

Adding properties of several objects into a new one

var target = {},
    obj1   = {one: 1, two: 2},
    obj2   = {three: 3};

Object.assign(target, obj1, obj2);
>>> Object { one: 1, two: 2, three: 3 }

Using it to override defaults

var target = {},
    defaults,
    options;
    
defaults = {
    a: 'default',
    b: 'default',
    c: 'default'
};

options = {
    b : 'overwritten'
};

Object.assign(target, defaults, options);
>>> Object { a: "default", b: "overwritten", c: "default" }

Comments

Marquita

I found your site from Google as well as I have to claim it was an excellent discover. Thanks!

Florence

Have you ever before had troubles with your web host? I'm open for suggestions as my webhost is awful right now.

Willy

Can you inform me what platform are you utilizing on this website?

Modesta

Have you ever had troubles with your webhost? I'm open for recommendations as my webhost is terrible currently.

Cathern

Can you inform me what system are you making use of on this web site?