public

extend()Method

Description

Extends an object by copying source object(s) properties to the target object. Target object properties that match properties in the source object(s) are overwritten, unmatched properties are copied. Note that the method is able to handle undefined source objects gracefully.

Parameters

Type Name Description
Object target The object to be extended
Object source The object or objects with which to extend target

Return Value

Type: Object

The extended object (the target object reflecting the result of the operation)

Example

 var obj1 = { a:1, b:2, c:3 };
 var obj2 = { d:4, e:5 };
 var obj3 = nokia.mh5.extend(obj1, obj2, { f:6 }); //obj3 = { a:1, b:2, c:3, d:4, e:5, f:6 }