A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/lodash-_-prototype-value-method/ below:

Lodash _.prototype.value() Method - GeeksforGeeks

Lodash _.prototype.value() Method

Last Updated : 09 Nov, 2023

Lodash _.prototype.value() method is used to execute the given chain sequence in order to resolve the unwrapped value. This method has the aliases _.prototype.toJSON and _.prototype.valueOf.

Syntax:
_.prototype.value()
Parameters:

This method does not accept any parameter.

Return Value:

This method returns the resolved unwrapped value.

Example 1: In this example, the code requires the Lodash library and demonstrates the usage of the _.prototype.value() method to obtain the final result from a wrapped Lodash object and then displays it in the console.

JavaScript
// Requiring lodash library
const _ = require('lodash');

// Using the _.prototype.value() method 
let result = _([5, 4, 7]).value();

// Display the result
console.log(result);

Output:

[ 5, 4, 7 ]

Example 2: In this example, the code requires the Lodash library, wraps an object with _(values), and uses the _.prototype.value() method to unwrap and obtain the original object, and then it displays the unwrapped object in the console.

JavaScript
// Requiring lodash library
const _ = require('lodash');

// Defining values
let values = { "f":3, "g":15 };

// Using the _.prototype.value() method 
let unwrap_val = _(values).value();

// Display the result
console.log(unwrap_val);

Output:

{ f: 3, g: 15 }


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4