Calling JavaScript Methods on Other Objects

preview_player
Показать описание
You''ll never stop being surprised by JavaScript. In this quick tip, I'm going to show you how to use the JavaScript methods call and apply to call your functions of other objects. Don't know what I mean? Let's get started!
Рекомендации по теме
Комментарии
Автор

I've been searching a while for a great explanation to call and apply. Found!

johnj
Автор

it's amazing how much better examples are then reading literature...great job thanks.

curiousfisherman
Автор

Major kudos man!  This is something I was struggling with in text and you explained it perfectly!

schi
Автор

Exactly what I was looking for! Thanks!

malcreatesstuff
Автор

Great! This is useful script.

Say I have a load of objects, each of which needs to have a similar set of functions. If I give each function it's unique functions, can I then put all the functions common to each object in a separate 'store room' object, and then use .apply() to get it from that 'store room' object? Would that be considered bad practice? Or would it be more efficient?

qwertyfinger
Автор

great job but one note, not everything in javascript is an object for example numbers and strings and booleans are actually considered primitive data types.

ryanhellerud
Автор

nicely explained, but needed some more info on APPLY()

SnehasishGhoshSg
Автор

I dont know who the people commenting below are, they must be friends of this guy but I couldnt see fuck all!

troglodyte
welcome to shbcf.ru