Friday, January 1, 2016

duck typing in JavaScript

On page 141 of "this & OBJECT PROTOTYPES" Kyle Simpson gives the following example of duck typing:

if (a1.something) {
   a1.something();
}

 
 

Basically, if I can see you, I'm gonna holla at you assuming you'll react favorably. This is an imperfect minimalistic sanity check for if it might be alright to holla. This shape of sanity checking is duck typing.

No comments:

Post a Comment