Underscore.js _.clone() Function Last Updated : 28 Apr, 2025 Comments Improve Suggest changes Like Article Like Report Underscore.js_.clone() function is used to create a shallow copy of the given object. The nested objects or arrays will be copied using reference, not duplicated. Syntax:_.clone( object );Parameters:object: It contains the value of the object that needs to be copied.Return Value: It returns the shallow copy of the given object. Example 1: This example shows the use of the underscore.js _.clone() function. html <!DOCTYPE html> <html> <head> <script type="text/javascript" src= "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js"> </script> </head> <body> <script type="text/javascript"> let info = { Company: 'GeeksforGeeks', Address: 'Noida', Contact: '+91 9876543210' }; console.log(_.clone(info)); </script> </body> </html> Output: Example 2: This example shows the use of the underscore.js _.clone() function. html <!DOCTYPE html> <html> <head> <script type="text/javascript" src= "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js"> </script> </head> <body> <script type="text/javascript"> let clon = _.clone({ Name: 'Ashok', Age: 32, Email: '[email protected]' }); console.log(clon); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article Underscore.js _.clone() Function A ashokjaiswal Follow Improve Article Tags : JavaScript Web Technologies JavaScript - Underscore.js Similar Reads Underscore.js _.chain() Function Underscore.js _.chain() function is an inbuilt function in the Underscore.js library of JavaScript which is used to find a wrapped object. Moreover, invoking the methods on this object will continue to return the wrapped objects until the value is invoked. Syntax:_.chain(obj);Parameters:obj: It is t 1 min read Underscore.js _.create() Function Underscore.js is a JavaScript library that provides a lot of useful functions that helps in the programming in a big way like the map, filter, invoke etc even without using any built-in objects. The _.create() function is an inbuilt function in Underscore.js library of JavaScript which is used to cr 2 min read Underscore.js _.constant() Function Underscore.js is a JavaScript library that makes operations on arrays, string, objects much easier and handy. The _.constant() function is used to create a function that returns the parameter given to it. It is almost same as _.identity() function. Note: It is very necessary to link the underscore C 2 min read Underscore.js _.bind() Function Underscore.js _.bind() function is used to bind a function to an object. When the function is called, the value of this will be the object. Syntax:_.bind(function, object, *arguments);Parameters:function: This parameter holds the function that needs to be executed. object: This parameter holds the o 2 min read Underscore.js _.extend() Function Underscore.js _.extend() function is used to create a copy of all of the properties of the source objects over the destination object and return the destination object. The nested arrays or objects will be copied by using reference, not duplicated. Syntax:_.extend(destination, *sources);Parameters: 1 min read Like