copy

makes a deep copy of an object

object copy(object source);

Parameters

sourceobjectthe source (passed) object

Returns

objectthe copy of the source object

Example

var obj1 = {name:"flower", type:"rose", colors: ['red','pink','white','yellow']  }
var obj2 = webix.copy(obj1);
 
 
obj1.type = 'tulip';
 
obj1.type // -> 'tulip'
obj2.type // -> 'rose'
 
obj2.colors // -> ['red','pink','white','yellow']

Details

Doesn't work for structures with inner loops.

See also
Back to top