Today, Douglas Crockford introduced a new project: JSDev. It solves a challenge with privacy: On one hand, you don’t want the outside world to have access to private functionality. On the other hand, you want to test it, via external unit tests.
JavaScript is Spartan when it comes to built-in data structures. One commonly uses objects as maps from strings to values. This post points out three pitfalls when doing so.
Allen Wirfs-Brock (the project editor of the ECMAScript 5 specification) recently mentioned the thought process behind method names such as Object.getOwnPropertyNames():
Update 2012-03-13: Added a section on installation.
Paul Miller’s es6-shim gives you functionality that will be in ECMAScript 6 (code-named ECMAScript.next), on ECMAScript 5 engines. It was initially based on a project of mine, but adds much new functionality, Node.js compatibility, and (not least) tests.
This post describes how to do a limited version of operator overloading in JavaScript.
With the technique described here, you’ll be able to implement a type StringBuilder that can be used as follows:
var sb = new StringBuilder();
sb << add("abc") << add("def");
And a type Point that can be used as follows:
var p = new Point();
p._ = new Point(1, 2) + new Point(3, 4) + new Point(5, 6);
p._ = new Point(1, 2) * new Point(3, 4) * new Point(5, 6);
Update 2012-08-21: All posts about shell scripting via Node.js have the label “jsshell”.
Do you know JavaScript and want to write a shell script? Then you should give Node.js a try. It is easy to install and shell scripts are a great way to get to know it. This post explains the basics.