JavaScript call() apply() bind() Methods In 90 Seconds #JavaScriptJanuary

preview_player
Показать описание
Watch the entire #JavaScriptJanuary series from the beginning!

In JavaScript the call(), apply(), and bind() methods can be used to assign an object to the “this” keyword.

The first argument is the object being assigned. Then we can pass in more arguments. These will then be used by the function.

The apply() method is similar to the call() method. The only difference is that the call() method takes arguments separately and the apply() method takes arguments as an array. So when working with arrays you would want to use apply().

There are other interesting things we can do with apply(). For instance, JavaScript arrays do not have a max() method. So if we have an array of numbers and we want to get the maximum value we could use apply().
Since we are not assigning anything to the “this” keyword, so we just set that to null then pass in our array.

The bind() method creates a new bound function, which wraps the original function object. So we are essentially creating a new function bound to the object. Then we call the function along with our arguments.

I'll be releasing a new video every day in January! Stay tuned..
_____________________________________

📚 Learn to CODE in just a FEW months here:
_____________________________________

🛠️ Tools I use:

_____________________________________

💖 Show support!
_____________________________________

Watch Next:
_____________________________________

Connect With Me:
_____________________________________

** Affiliate Disclaimer: Some of the above links may be affiliate links, which may generate me a sales commission at no additional cost to you.

#JavaScriptJanuary #31Days31Videos #codeSTACKr
Рекомендации по теме
Комментарии
Автор

Thanks for all of the support! Stay tuned for a new video every day in January!!

Watch the entire #JavaScriptJanuary series from the beginning!

📚 My Favorite Web Design Books 📚
Web Design with HTML, CSS, JavaScript and jQuery Set by Jon Duckett (paid link)

codeSTACKr
Автор

Amazing video. Short and clear. Best 90 sec ever spent!

Автор

90 secs of your video content is more worth than other techniques I used to get this concept. Kudos!

anveshreddy
Автор

For the example using Math.max on an array, you could alternatively use the spread syntax instead of apply(). I think it’s cleaner and more readable:
const numbers = [1, 2, 3, 4, 5];
console.log( Math.max(...numbers) );

ash.mystic
Автор

Wow! Straight, direct, and to the point. Can you do a video on everything in my entire life?

Newtypenewtype
Автор

Very nice explanation. Clear and concise!

BlaBlaBlaInDaHouse
Автор

seriously, It made a difference. Thank you

webdev
Автор

Thank you for this short & clear explaining

easifier
Автор

Nice, today I learned some new JS methods, thanks .

codemachine
Автор

Thank you, very usefull video!
I liked a lot the trick to find the max of an array of numbers. This actually can be done with any object, for example: Math.max.apply(window, numbers);
Another way to find the max is:
Math.max(...numbers);

dimitrisandroid
Автор

I'm from the future, your Code still help ☺️

kesomedia
Автор

If i can suggest any videos i would ask for javascript classes i am working on learning react ant it.uses it alot so words like super and props and binding methods is really confusing to me even after reading some articles

mahmoudsalah
Автор

Very helpful video, short and simple explanation with an example. The voice quality is Superb, because of this the video is very interesting and understandable.

UsamaKhan-umnr
Автор

How can you make these video. I mean which software, I want to learn to make it in my languague for my friend

tinpham
Автор

bind method explanation is not understandable. very fast sir

SomeshNukala
Автор

@1:34() {why do you lie? ... It's not a 90 second video, it's exactly a 101 second video("1 min " "+ " "41 seconds")} 🤭🤭🤭

duttybwoy
Автор

So, he basically copy pasted everything from w3schools. Get a life man.

subhras