Posts tagged with "javascript"
Currying in JavaScript using bind()
February 6th, 2012
Currying, or more accurately, partial application is the process of breaking down a function that takes multiple arguments into a series of functions that take parts of the arguments. It comes in handy whenever you don’t have all the required arguments to a function at the present time. For example, consider a function add that [...]
Thoughts on Socket.IO
January 30th, 2012
I have been hacking away with Socket.IO for the past few months. My initial goal was to explore how Node.js/Socket.IO scales when you need to support a largish audience, when compared to my previous solutions involving Erlang/OTP and a handmade COMET library. I have built these COMET based streaming solutions by hand a few years [...]
First element of an object in JavaScript
January 17th, 2012
This one will go into the bag of clever hacks which you should use sparingly, if not ever. Given an object like this: var obj = { a: "foo", b: "bar", c: "baz" } Here’s how we get the “first” property of the object/dict: for (var first in obj) break; console.log("First property is: "+first); We’re [...]
ECMAScript harmony features in Chrome Canary
December 26th, 2011
The latest Canary build of Google Chrome allows you to unlock some new features from ECMAScript Harmony. However, they are disabled by default, so to enable them you have to type about:flags into your address bar, and turn on “Enable Experimental JavaScript” which is found right at the bottom of the page. Now, you have [...]
ECMAScript 6 looks promising
November 22nd, 2011
I am quite excited about ECMAScript 6, after watching David Herman’s talk at YUIConf 2011. I am especially looking forward to seeing some of these features landing up on V8 soon, so that I can use it on node.js. These additions will solve many common sources of frustration that newcomers face when working with JavaScript. [...]