Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc.
The_.unescape() method is used to convert HTML entities like &, <, >, " and ‘ in the given string to their corresponding characters.
Syntax:
_.unescape( string )
Parameters: This method accepts a single parameter as mentioned above and described below:
- string: It is the string to be used for unescaped.
Return Value: This method returns the unescaped string.
Example 1:
Javascript
// Defining Lodash variable const _ = require( 'lodash' ); // The string to unescape var str = "fit & fine" ; // Using _.unescape() method console.log(_.unescape(str)); |
Output:
fit & fine
Example 2:
Javascript
// Defining Lodash variable const _ = require( 'lodash' ); // The string to unescape var str = ""Heyy"" ; // Using _.unescape() method console.log(_.unescape(str)); |
Output:
"Heyy"