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
Next Article:
Lodash _.curry() Method
Next article icon

Lodash _.bindKey() Method

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

Lodash _.bindKey() method of Function in lodash is used to create a function that calls the method at the object[key] along with the partials added to the arguments it accepts.

Note:

  • This method is different from the _.bind() method as it permits bound functions to mention methods that may be reinterpreted or do not still exist.
  • The _.bindKey.placeholder value that is by default ( _ ) in monolithic builds which is utilized as a placeholder for partially used arguments.

Syntax:

_.bindKey(object, key, partials);

Parameters:

  • object: It is the object that is used to call the method.
  • key: It is the key to be used in the method.
  • partials: It is the arguments that are to be partially applied. It is an optional parameter.

Return Value:

  • This method returns the new bound function.

Example 1: In this example, we are passing partials to the function and printing the result into the console by the use of the lodash _.bindKey() method.

JavaScript
// Requiring lodash library const _ = require('lodash');  // Defining object parameter of this method let obj = {     'author': 'Nidhi',     'welcome': function (greet, mark) {         return greet + ' ' + this.author + mark;     } };  // Using the _.bindKey() method  // with its parameters let bound_fun =     _.bindKey(obj, 'welcome', 'Hello');  // Calling bound_fun by passing its value console.log(bound_fun('!!')); 

Output:

Hello Nidhi!!

Example 2: In this example, we are passing partials to the function and using a bound with the placeholder then printing the result into the console by the use of the lodash _.bindKey() method.

JavaScript
// Requiring lodash library const _ = require('lodash');  // Defining object parameter of this method let obj = {     'portal': function (portal, mark) {         return 'Welcome to ' + portal + mark;     } };  // Using the _.bindKey() method with its // parameters and a placeholder let bound_fun =     _.bindKey(obj, 'portal', _, '!');  // Calling bound_fun by passing its value console.log(bound_fun('GeeksforGeeks')); 

Output:

Welcome to GeeksforGeeks!

Next Article
Lodash _.curry() Method

N

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

Similar Reads

    Lodash _.after() Method
    Lodash _.after() method is opposite of Lodash _.before() method. This method creates a function that invokes function once it’s called n or more times.Syntax:_.after(n, func);Parameters: n: This parameter holds the number n, which defines the number of calls before func is invoked.func: This paramet
    2 min read
    Lodash _.ary() Method
    Lodash _.ary() method is used to create a function that invokes the given function, up to n arguments, ignoring any additional arguments.Syntax:_.ary( func, n )Parameters: This method accepts two parameters as mentioned above and described below:func: This parameter holds the function which will cap
    2 min read
    Lodash _.before() Method
    Lodash _.before() method is the opposite of the Lodash _.after() method. This method is used to create a function that invokes func with the binding and arguments of the created function, while it’s called less than n times.Syntax:_.before(n, func);Parameters: n: This parameter holds the number n, w
    2 min read
    Lodash _.bind() Method
    Lodash _.bind() method is used to create a function that invokes the given function with the binding of thisArg and it is used to bind a function to an object. When the function is called, the value of this will be the object. The _.bind.placeholder value, which defaults to _ in monolithic builds, m
    2 min read
    Lodash _.bindKey() Method
    Lodash _.bindKey() method of Function in lodash is used to create a function that calls the method at the object[key] along with the partials added to the arguments it accepts.Note:This method is different from the _.bind() method as it permits bound functions to mention methods that may be reinterp
    3 min read
    Lodash _.curry() Method
    Lodash _.curry() method returns a curried version of the given function. it accepts an arity which is a number that shows it will keep accepting arguments until it has received this number of arguments or invocings.Syntax:_.curry(fun, [arity=fun.length])Parameters: fun: This is the given function. [
    2 min read
    Lodash _.curryRight() Method
    Lodash _.curryRight() method is used to return a curried version of the given function where the given arguments are processed from right to left.Syntax:_.curryRight(fun);Parameters: fun: This is the function that should be used in the current version.Return Value: This method returns the curried fu
    2 min read
    Lodash _.debounce() Method
    The Lodash _.debounce() method is a utility function that delays the execution of a given function until a specified wait time has passed since the last invocation. This method is particularly useful in scenarios where events fire frequently, such as resizing, scrolling, or input events, helping pre
    3 min read
    Lodash _.defer() Method
    Lodash _.defer() method in lodash is used to defer the calling of the func parameter until the recent call stack is cleared. Moreover, any further arguments are provided to the function parameter of this method when it is called.Syntax:_.defer(func, [args]);Parameters:func: It is the function that i
    2 min read
    Lodash _.delay() Method
    Lodash _.delay() method is used to call the given function as the parameter after the stated wait time is over, which is in milliseconds. Any further arguments are provided to the function when it is called.Syntax:_.delay(func, wait, args);Parameters: func: It is the function that has to be delayed.
    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