2011-10

A quick overview of JavaScript

[2011-10-30] dev, javascript, jslang
Update 2013-06-22:Basic JavaScript: an introduction to the language” is an improved longer version of this post.

This post gives an overview of JavaScript that is as short as possible, but explains every major feature. Give the language a chance! You have to learn its quirks, but then it is fun to program in.

Real-world Twitter

[2011-10-29] mobile, app, iphone, computers
“Big Words” is a very simple iPhone app idea: Use your mobile device to display Twitter-style messages to other people, in the real world. Fittingly, one of its creators is a Twitter co-founder.

JavaScript: Why the hatred for strict mode?

[2011-10-28] dev, javascript, jslang
There seem to be people who hate ECMAScript 5’s strict mode. This post shows that this hatred is not justified and provides work-arounds for features that are missing.

String concatenation in JavaScript

[2011-10-25] dev, javascript, jslang
There are two ways of doing string concatenation in JavaScript. This post demonstrates them and explains which one is faster.

Enums for JavaScript

[2011-10-24] dev, javascript, advancedjs, jslang
This post describes a JavaScript implementation of enums, enumerations of symbols. The idea originally comes from Allen Wirfs-Brock, via a thread on the es-discuss mailing list.

Printing objects on Node.js

[2011-10-23] dev, nodejs, javascript
Problem: If a data structure is too deeply nested, Node.js stops showing the details. This post presents two solutions.

Universal modules (browser, Node.js): imports and universal tests

[2011-10-20] dev, javascript, jsmodules, jslang
Update 2011-11-19. This post is now superseded by “Bridging the module gap between Node.js and browsers”.

This post explains how to write modules that are universal – they run on browsers and Node.js. A previous post showed a simple way of doing so, this post presents a more sophisticated solution that also handles modules importing other modules. Additionally, we use the unit test framework Jasmine to write tests for those modules that are equally universal.

Universal unit testing (browser, Node.js) with Jasmine

[2011-10-18] dev, javascript, jsmodules, jslang, jstools
Update 2011-11-19: Bridging the module gap between Node.js and browsers. [With the given information, you can write your unit tests as modules that run on both platforms.]

This post gives a quick introduction to the JavaScript unit test framework Jasmine. It has the advantage of allowing tests to be run both in browsers and on Node.js.

A JavaScript class pattern that starts with a function

[2011-10-17] dev, javascript, jslang
There are too many JavaScript class patterns and inheritance APIs out there. Here is another one. The twist: Its core construct is a function, not an object literal.

The power of the Asynchronous Module Definition

[2011-10-14] dev, javascript, jsmodules, jslang
Update 2011-11-19: Bridging the module gap between Node.js and browsers

This post explains Asynchronous Module Definition (AMD), a standard for defining modules in JavaScript and contrasts it with the currently very popular CommonJS synchronous modules.