VOOZH about

URL: https://www.geeksforgeeks.org/javascript/underscore-js-_-clone-function/

⇱ Underscore.js _.clone() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Underscore.js _.clone() Function

Last Updated : 12 Jul, 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.

Output:

👁 Image

Example 2: This example shows the use of the underscore.js _.clone() function.

Output:

👁 Image
Comment