External: Object

Object

The built in Object object.
Source:
object.js, line 7
See:

Methods

assign(target, sources) → {Object}

The Object.assign() method is used to copy the values of all enumerable own properties from one or more source objects to a target object. The Object.assign method only copies enumerable and own properties from a source object to a target object. It uses [[Get]] on the source and [[Put]] on the target, so it will invoke getters and setters. Therefore it assigns properties versus just copying or defining new properties. This may make it unsuitable for merging new properties into a prototype if the merge sources contain getters. For copying propertiy definitions, including their enumerability, into prototypes Object.getOwnPropertyDescriptor and Object.defineProperty should be used instead.
Parameters:
Name Type Description
target Object The target object.
sources Array.<Object> The source object(s).
Source:
object.js, line 106
See:
Returns:
The target object gets returned.
Type
Object
Example
// Merging objects
var o1 = { a: 1 };
var o2 = { b: 2 };
var o3 = { c: 3 };

var obj = Object.assign(o1, o2, o3);
console.log(obj);
// { a: 1, b: 2, c: 3 }

create(o)

Prototypal Inheritance Create Helper
Parameters:
Name Type Description
o Object
Source:
object.js, line 41
See:
Example
// declare oldObject
oldObject = new Object();
// make some crazy stuff with oldObject (adding functions, etc...)
// ...

// make newObject inherits from oldObject
newObject = Object.create(oldObject);

is(a, b) → {Boolean}

The Object.is() method determines whether two values are the same value.
Parameters:
Name Type Description
a Object The first value to compare
b Object The second value to compare
Source:
object.js, line 65
See:
Returns:
Type
Boolean
Example
// Strings are equal
var s = "foo";
Object.is(s, "foo"); //> true

// 0 and -0 are not equal
Object.is(0, -0); //>false

// NaN and NaN are equal
Object.is(NaN, NaN); //> true

// Two object references are not equal
Object.is({}, {}); //> false

// Two vars referencing one object are equal
var a = {}, b = a;
Object.is(a, b); //> true
Copyright © 2011 - 2017, Olivier Biot, Jason Oster, Aaron McLeod
Documentation generated by JSDoc 3.4.0 on 2017-02-28T11:37:40+08:00 using the DocStrap template modified by codename-.