I am Hack Sparrow
Captain of the Internets.

JavaScript .bind() vs .apply() and .call()

So, what's the point of .bind() when we already have .apply() and .call()? For those not familiar with .bind(), .apply(), and .call(), here is a quick summary with this object [code] var fruit = { name: 'Apple' } [/code] and this function [code] function showDetails(size, price) { console.log(this.name + ' ' + size + ': $' + price + '/kg') } [/code] on mind. All three of them are function meth ...

JavaScript Array-like Objects

Have you heard about array-like objects in JavaScript? If no, this is a good post to learn about them. Array-like objects are not a separate object type, they are the same old object we are familiar with, except they 'look' like arrays. What do I mean by that? Let's find out. You might be familiar with the arguments variable which every JavaScript function has access to by default. We access its items using arguments[0], arguments[1] etc. Let's take a lo ...

JavaScript – .apply and .call

Maybe you have heard about them, maybe you are new to them, but the apply and call JavaScript functions are one of the less encountered and less well understood aspects of JavaScript - primarily because of their unfamiliarity. Why are they unfamiliar? Most of the learning materials (tutorials and books) available for JavaScript tend to teach JavaScript in the C/Java mindset. Most JavaScript beginners endeavor to find out the c ...