Open In App
Related Articles

Lodash _.prototype.value() Method

Improve Article
Improve
Save Article
Save
Like Article
Like

Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc.

The _.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:

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:

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 }
Last Updated : 18 Sep, 2020
Like Article
Save Article
Similar Reads
Related Tutorials