Underscore.js _.chain() Function (original) (raw)

Last Updated : 10 Jan, 2024

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:

**Return Value:

This method returns a wrapped object.

**Example 1: In this example, we are using the Underscore.js _.chain() function.

HTML `

Document
<head>
    <script src=

"" title="undefined" rel="noopener noreferrer">https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js">

<body>
    <script>
        console.log(_.chain([99, 3, 4, 6]).push(100)); 
    </script>
</body>

</html>

`

**Output:

[99, 3, 4, 6, 100]

**Example 2: In this example, we are using the Underscore.js _.chain() function.

javascript `