Ajay Yadav
Ajay Yadav

@ATechAjay

8 Tweets Jan 26, 2023
๐Ÿ“ข The Ultimate Guide To The `bind( )` Method In JavaScript!
๐Ÿ’˜ You can think of the ` bind( ) ` method as a ๐—ฟ๐—ฒ๐—น๐—ฎ๐˜๐—ถ๐—ผ๐—ป๐˜€๐—ต๐—ถ๐—ฝ between 2 couples. They are "function" and "object"
"object" เค•เฅ‹ "male" เคฎเคพเคจเคฒเฅ‹๐Ÿ˜…
๐Ÿงตโ†“
๐Ÿ’ก bind( ) method:
๐Ÿญ An object can borrow a method or function from another object using the bind( ) method. This is known as "function borrowing" in JavaScript.
๐Ÿญ The bind( ) method creates a new function where "this" object refers to the parameter in the parentheses.
๐Ÿญ In this example (Next Tweet):
โ†’ The "user1" object borrows a function called "fullName" using `bind( )` method.
โ†’ And the first parameter of the ` bind( )` method is "user1", which refers to the "this" object, and the second one is for the function itself.
โ†’ It returns a function called "user1FullName" and just we have to call this function followed by parentheses.
โ†’ But if you want to pass arguments in the new function, then you can do it.
like:
user1FullName('America');
๐Ÿญ Some Examples:
๐Ÿญ Learn the `call( )` method from this thread:
๐Ÿญ Learn the `apply( )` method from this thread:
That's all for now, we will meet in the next thread๐Ÿ˜
๐Ÿ”” Follow Me @ATechAjay
For:
๐ŸŒ Web Development
โœจ JavaScript
๐Ÿ“ Writing Skill
๐Ÿ”ฅ Motivation
๐Ÿ’น Growth
โ›” But Not For Only Resources & Shitpost ๐Ÿ˜
Thank you so much for staying to the end of this thread๐Ÿ’š

Loading suggestions...