Lodash _.unescape() Method
Last Updated :
25 Oct, 2023
Lodash _.unescape() method is used to convert HTML entities like &, <, >, " and ' in the given string to their corresponding characters.
Syntax:
_.unescape(string);
Parameter:
- string: It is the string to be used for unescaped.
Return Value:
This method returns the unescaped string.
Example 1: In this example, we are converting HTML entities into corresponding characters by the use of the _.unescape() method.
Javascript
const _ = require( 'lodash' );
let str = "fit & fine" ;
console.log(_.unescape(str));
|
Output:
fit & fine
Example 2: In this example, we are converting "Heyy" into corresponding characters by the use of the _.unescape() method.
Javascript
const _ = require( 'lodash' );
let str = ""Heyy"" ;
console.log(_.unescape(str));
|
Output:
"Heyy"
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...