Monday, November 4, 2013

Having fun with Function.prototype.call

In javascript, using the .call() method allows you to specify the context of whatever object you pass to it. This allows you to call a string method from an array context, and vice versa.

Check out the following script...

In all honesty, it may not be a good idea to use these methods, because they aren't supported on these objects, but check out what happens!

Go nuts and try out some other methods and post them in the comments to see what you come up with.

No comments:

Post a Comment