Underscore.js _.clone() Function (original) (raw)
Last Updated : 25 Apr, 2025
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
**Output:
**Example 2: This example shows the use of the underscore.js _.clone() function.
html
**Output:
Similar Reads
- Underscore.js _.compose() Function The _.compose() function is used to return the composition of the list of functions. The list of the function returns the value of the function that follows. Syntax: _.compose(*functions) Parameters: This function accept a single parameter as mentioned above and described below: functions: It contai 1 min read
- 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 _.before() Function _.before() function in underscore.js is used to call a particular function a particular number of times. It uses a count variable that keeps the track of number of times the function is called. Syntax: _.before(count, function) Parameters: Count: It is the number of times a function is to be called. 2 min read
- Underscore.js _.escape() function Underscore.js _.escape() function is used to escape a special character string from inserting into HTML. Some of the strings that get escape are "&", ">", "<", "''", etc. Note: Some special files are needed to be included while using this code directly in the browser. It is very necessary 1 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 _.each() 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 _.each() function is an inbuilt function in Underscore.js library of JavaScript which is used to retu 3 min read
- Underscore.js _.functions() Function Underscore.js _.functions() function is used to return the sorted list of all methods that are present in an object. Syntax:_.functions(object);Parameters: object: It contains the object element that holds the elements [key, value] pair.Return Value: It returns the sorted list of all methods that ar 1 min read
- Underscore.js _.after() Function Underscore.js is a JavaScript library that provides a lot of useful functions that help in the programming in a big way like the map, filter, invoke, etc even without using any built-in objects. The _.after() function is an inbuilt function in Underscore.js library of JavaScript which is used to cre 2 min read