Ajay Yadav
Ajay Yadav

@ATechAjay

6 Tweets Jan 26, 2023
πŸ“’ The Ultimate Guide To The `apply( )` Method In JavaScript!
🧡 ↓
🍭 The "apply( )" method is similar to the "call( )" method, so you need to know about the call method first.
πŸ”” You can learn it from this thread:
🍭 The only difference is their way of passing arguments to the function.
🍭 The `apply( )` method takes arguments as an array, but the `call( )` method takes arguments separately.
πŸ”” You can see this in the code snippet:
🍭 "addresUser2" is an array that is passed to the function of the user1 object with the `apply( )` method.
πŸ“’ Again, Please read the thread on the `call( )` method first.
πŸ€” But, do you know we can achieve this goal with a spread operator(...)?
🍭 Yes, we can unpack the elements of the array using the spread operator.
🍭 So, we can use the `call( ) method instead of the `apply( )` method with the spread(...) operator.
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...