Saturday, September 21, 2024
Google search engine
HomeLanguagesJavascriptLodash _.unescape() Method

Lodash _.unescape() Method

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"
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments