clone

makes a shallow copy of an object

object clone(object source);
sourceobjectthe source (passed) object
objectthe copy of the source object

Example

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

See also
Back to top