Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Lodash-Array
  • Lodash-Collection
  • Lodash-Function
  • Lodash-Lang
  • Lodash-Math
  • Lodash-Object
  • Lodash-Sequence
  • Lodash-String
  • Lodash-Util
  • JavaScript
  • Web Technology
Open In App

Lodash _.isEqualWith() Method

Last Updated : 04 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Lodash _.isEqualWith() method of Lang in lodash is similar to the _.isEqual() method and the only difference is that it accepts a customizer which is called in order to compare values. Moreover, if the customizer used here returns undefined then the comparisons are dealt with by the method instead. 

Note:

The customizer used here can be called with up to six arguments namely objValue, othValue, index|key, object, other, and stack.

Syntax:

_.isEqualWith(value, other, [customizer]);

Parameters:

  • value: It is the value to be compared.
  • other: It is the other value to be compared.
  • customizer: It is the function that is used to customize comparisons.

Return Value:

This method returns true if the stated values are equivalent otherwise it returns false.

Example 1: In this example, we are checking whether the given two arrays are equal or not by the use of the Lodash _isEqualWith() method.

JavaScript
// Requiring lodash library const _ = require('lodash');  // Defining a function portal function portal(val) {     return /^G(?:fG|eeksforGeeks)$/.test(val); }  // Defining customizer to compare values function customizer(objectValue, otherValue) {     if (portal(objectValue) && portal(otherValue)) {         return true;     } }  // Initializing values let val = ['GeeksforGeeks', 'CS-portal']; let otherval = ['GfG', 'CS-portal'];  // Calling isEqualWith() method with all // its parameter let result = _.isEqualWith(val, otherval, customizer);  // Displays output console.log(result); 

Output:

true

Example 2: In this example, we are checking whether the given two arrays are equal or not by the use of the Lodash _isEqualWith() method.

JavaScript
// Requiring lodash library const _ = require('lodash');  // Defining a function portal function portal(val) {     return /^G(?:fG|eeksforGeeks)$/.test(val); }  // Defining customizer to compare values function customizer(objectValue, otherValue) {     if (portal(objectValue) && portal(otherValue)) {         return true;     } }  // Initializing values let val = ['GeeksforGeeks', 'CS-portal']; let otherval = ['GfG', 'portal'];  // Calling isEqualWith() method with all // its parameter let result = _.isEqualWith(val, otherval, customizer);  // Displays output console.log(result); 

Output:

false

Example 3: In this example, we are checking whether the given two arrays are equal or not by the use of the Lodash _isEqualWith() method.

JavaScript
// Requiring lodash library const _ = require('lodash');  // Defining a function gfg function gfg(val) {     return val; }  // Defining customizer function intg(x, y) {     if (gfg(x) === gfg(y)) {         return true;     } }  // Calling isEqualWith() method with all // its parameter let result = _.isEqualWith('gf', 'gfg', intg);  // Displays output console.log(result); 

Output:

false

Reference: https://lodash.com/docs/4.17.15#isEqualWith


N

nidhi1352singh
Improve
Article Tags :
  • JavaScript
  • Web Technologies
  • JavaScript-Lodash

Similar Reads

    Lodash _.castArray() Method
    Lodash _.castArray() method is used to cast value into an array if it is not an array.Syntax: _.castArray(value);Parameters:  value: This parameter holds the value that needs to be inspected.Return Value:It returns an array with the including value passed in the _.castArray().Example 1: In this exam
    2 min read
    Lodash _.clone() Method
    Lodash _.clone() method is used to create a shallow copy of the value. This method supports cloning arrays, array buffers, booleans, date objects, maps, numbers, Object objects, regexes, sets, strings, symbols, and typed arrays. It is loosely based on the structured clone algorithm. Syntax:_.clone(v
    2 min read
    Lodash _.cloneDeep() Method
    The Lodash _.cloneDeep() method is handy for making a complete copy of a value. It goes deep into the value, copying everything inside it too. So, the new object you get has the exact same data as the original, but they're not linked in memory.This method is similar to the _.clone() method.Syntax: _
    2 min read
    Lodash _.cloneDeepWith() Method
    Lodash .cloneDeepWith() method is used to clone value in a recursive way, just the same as the  _.cloneWith() method but performs in a recursive manner.Syntax:_.cloneDeepWith( value, [customizer]);Parameters: value: This parameter holds the value which will be cloned in a recursive way.customizer: T
    2 min read
    Lodash _.cloneWith() Method
    Lodash _.cloneWith() method of Lang in lodash is similar to the _.clone() method and the only difference is that it accepts a customizer which is called in order to generate cloned value. Moreover, if the customizer used here returns undefined then the cloning is dealt with by the method instead.Not
    2 min read
    Lodash _.conformsTo() Method
    Lodash _.conformsTo() method is used to check if the given object conforms to the given source by invoking the predicate properties of the source with the corresponding property values of the object. It returns true if it conforms, else false.Syntax:_.conformsTo( object, source );Parameters: object:
    2 min read
    Lodash _.eq() Method
    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: value: This parameter holds the value to compare.other: This p
    2 min read
    Lodash _.gt() Method
    Lodash _.gt() method is used to find whether the value is greater than others or not. It returns true if the value is greater than the other value. Otherwise, it returns false.Syntax:_.gt(value, other);Parameters: value: This parameter holds the value to compare.other: This parameter holds the other
    2 min read
    Lodash _.gte() Method
    Lodash _.gte() method is used to check whether the specified value is greater than or equal to another or not.Syntax:_.gte(value, other);Parameters: value: This parameter holds the first value to compare.other: This parameter holds the second value to compare.Return Value: This method returns a bool
    2 min read
    Lodash _.isArguments() Method
    Lodash _.isArguments() method checks if the value is likely an arguments object. Syntax:_.isArguments(value);Parameters: value: It is the function that is used to check the value.Return Value: This method returns true if the value is an argument object else false. Example 1: In this example, we are
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences