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 _.minBy() Method

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

Lodash _.minBy() method is used to compute the minimum value from the original array by iterating over each element in the array using the Iteratee function. It is almost the same as the _.min() function.

Syntax:

_.minBy(array, [iteratee = _.identity]);

Parameters:

  • array: It is the array that the method iterates over to get the minimum element.
  • iteratee: It is the function that is invoked for every element in the array.

Return Value:

This method returns the minimum element.

Example 1: In this example, we are printing the minimum value of the given array by the use of the _.minBy() method.

JavaScript
// Requiring the lodash library   const _ = require("lodash");  // Original array  let arr = [{ 'n': 4 }, { 'n': 2 }, { 'n': 6 }];  // Use of _.minBy() method  let min_val =     _.minBy(arr, function (o) { return o.n; });  // Printing the output   console.log(min_val);  

Output:

{ 'n': 2 }

Example 2: In this example, we are printing the minimum value of the given array by the use of the _.minBy() method.

JavaScript
// Requiring the lodash library   const _ = require("lodash");  // Original array  let arr = [{ 'n': 10 }, { 'n': 5 }, { 'n': 3 }, { 'n': 12 }];  // Use of _.minBy() method  let min_val = _.minBy(arr, 'n');  // Printing the output   console.log(min_val);  

Output:

{ 'n': 3 }

S

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

Similar Reads

    Lodash _.add() Method
    Lodash _.add() method is used to add two numbers. Syntax:_.add(augend, addend);Parameters:augend: This parameter holds the first number in addition.addend: This parameter holds the second number in addition.Return Value: This method returns the result of adding two numbers. Example 1: In this exampl
    1 min read
    Lodash _.ceil() Method
    Lodash _.ceil() method is used to compute numbers rounded up to precision.Syntax:_.ceil(number, [precision = 0]);Parameters: number: This parameter holds the number to round up.[precision=0]: This parameter holds the precision to round up to.Return Value: This method returns the rounded-up number.Ex
    2 min read
    Lodash _.divide() Method
    Lodash _.divide() method is used to divide two numbers.Syntax:_.divide(dividend, divisor);Parameters: dividend: This parameter holds the first number in a division.divisor: This parameter holds the second number in a division.Return Value: This method returns the quotient after dividing two numbers.
    2 min read
    Lodash _.floor() Method
    Lodash _.floor() method is used to compute numbers rounded down to precision means it rounded down to the floor value.Syntax:_.floor(number, [precision = 0])Parameters: This method accepts two parameters as mentioned above and described below:number: This parameter holds the number to round down.[pr
    2 min read
    Lodash _.max() Method
    Lodash _.max() method is used to find the maximum element from the array. If the array is empty then undefined is returned.Syntax:_.max( array );Parameters:array: It is the array that the method iterates over to get the maximum element.Return Value: This method returns the maximum element from the a
    2 min read
    Lodash _.maxBy() Method
    Lodash _.maxBy() method is used to compute the maximum value from the original array by iterating over each element in the array using the Iteratee function. It is almost the same as the _.max() function.Syntax:_.maxBy( array, [iteratee = _.identity] );Parameters: array: It is the array that the met
    3 min read
    Lodash _.mean() Method
    Lodash_.mean() method is used to find the mean of the values in the array.Syntax:_.mean( array )Parameters: This method accepts a single parameter as mentioned above and described below:array: It is the array that the method iterates over to get the mean of all the values.Return Value: This method r
    3 min read
    Lodash _.meanBy() Method
    Lodash _.meanBy() method is used to compute the mean value from the original array by iterating over each element in the array using the Iteratee function. It is almost the same as the _.mean() function.Syntax:_.meanBy(array, [iteratee = _.identity]);Parameters: array: It is the array that the metho
    2 min read
    Lodash _.min() Method
    Lodash _.min() method is used to find the minimum element from the array. If the array is empty then undefined is returned.Syntax:_.min(array);Parameters: array: It is the array that the method iterates over to get the minimum element.Return Value: This method returns the minimum element from the ar
    2 min read
    Lodash _.minBy() Method
    Lodash _.minBy() method is used to compute the minimum value from the original array by iterating over each element in the array using the Iteratee function. It is almost the same as the _.min() function.Syntax:_.minBy(array, [iteratee = _.identity]);Parameters:array: It is the array that the method
    3 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