Returns a clone, also known as a deep copy, of a variable
or XML object. There is no reference to the original variable.

duplicate(variable) → returns any

duplicate Argument Reference

variable any

Examples sample code invoking the duplicate function

Copy a string and change it. Original string stays unchanged.

myString = 'Hello world!';
myNewString = duplicate(myString);
myNewString = Replace(myNewString,'world','universe');
writeOutput(myString&' → '&myNewString);

Expected Result: Hello world! → Hello universe!

Fork me on GitHub