A RetroSearch Logo

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

Search Query:

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

Lodash _.eq() Method - GeeksforGeeks

Lodash _.eq() Method

Last Updated : 03 Sep, 2024

Lodash _.eq() method is used to find whether the two values are equivalent or not by performing the SameValueZero comparison. It returns true if the values are equivalent. Otherwise, it returns false.

Syntax:
_.eq(value, other);
Parameters: Return Value:

Example 1: In this example, we are checking whether the given two values are the same or not by the use of the _.eq() method.

JavaScript
// Requiring the lodash library  
const _ = require("lodash");  
     
// Use of _.eq method 
console.log(_.eq("Geeks", "Geeks" )); 
console.log(_.eq("Geeks", Object("Geeks"))); 
console.log(_.eq(NaN, NaN)); 

Output:

true
false
true

Example 2: In this example, we are checking whether the given two objects are the same or not by the use of the _.eq() method.

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

// Given values
let object = { 'gfg': 2020 };
let other = { 'gfg': 2020 };

// Use of _.eq method 
console.log(_.eq(object, object));
console.log(_.eq(object, other));

Output:

true
false


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