Mimicking bind, call and apply

by vehikl on April 17, 2015

In a piece about JavaScript’s this, Colin DeCarlo discusses mimicking bind, call and apply:

Recently, I’ve been working on a presentation about JavaScript’s this. this is a really interesting topic and the preparation has got me thinking a lot about context and how it’s applied within the execution of a JavaScript function.

I wanted to see if I could mimic the bind, call and apply methods of Function.prototype from first principles. I wasn’t sure if this was even going to be possible as this in a functions execution context is really well protected. In the end, bind turned out to be my work horse, whether using bind in the implementation of these functions is considered cheating is for you to decide.

Continue reading Colin’s piece.

The following two tabs change content below.


We are a team of passionate software artisans. We believe in user-centered design and and focus on writing clean, maintainable code.

Latest posts by vehikl (see all)