2013-04

JavaScript quirk 3: normal equality (==)

[2013-04-24] dev, twelvequirks, javascript, jslang
[This post is part of a series on JavaScript quirks.]

Let’s start with a simple rule: the normal equality operators == and != are so problematic that you should always use strict equality (=== and !==). Some people say that there are exceptions to this rule, I disagree [2]. Keeping this rule in mind, we can now take a look at what is strange about ==, without burdening our minds unnecessarily.

Checking for undefined: === versus typeof versus falsiness

[2013-04-19] dev, javascript, jslang
There are several ways of checking whether a variable has the value undefined. This blog post explains the differences.

JavaScript quirk 2: two “non-values” – undefined and null

[2013-04-14] dev, twelvequirks, javascript, jslang
[This post is part of a series on JavaScript quirks.]

Most programming languages have only one value for “no value” or “empty reference”. For example, that value is null in Java. JavaScript has two of those special values: undefined and null. They are basically the same (something that will change with ECMAScript 6, as will be explained in the last post of this series), but they are used slightly differently.

12 JavaScript quirks

[2013-04-08] dev, twelvequirks, javascript, jslang
A core of JavaScript (the so-called “good parts”) is elegant, but that core is often obscured by quirks. This introduction is the first of a series of blog posts that looks at twelve common quirks and how to best deal with them:

JavaScript quirk 1: implicit conversion of values

[2013-04-08] dev, twelvequirks, javascript, jslang
[This post is part of a series on JavaScript quirks.]

JavaScript is very tolerant when it comes to accepting values. For example, everywhere it expects a number, it does not reject values from other types, but tries to convert them:

    > '5' - '2'
    3
    > '5' * '2'
    10
Automatic conversion to boolean is rarely problematic and often useful. It is covered here as a preparation for later – we’ll use it to work around quirks. Automatic conversion to string, however, can cause problems.

Google’s Blink: a few interesting facts

[2013-04-05] browser, dev, blink, webkit, google, webdev, chrome
With Blink, Google has created a permanent fork of the WebKit HTML engine. This blog post mentions a few interesting facts that provide context for that decision.

Enforcing toString()

[2013-04-04] dev, javascript, jslang
JavaScript usually automatically converts values to the type that a method or operator needs, which can lead to a variety of bugs. As a counter-measure, Brian McKenna (@puffnfresh) suggests using the following code for your tests:
    Object.prototype.valueOf = function () {
        throw new Error('Use an explicit toString');
    };

ECMAScript Harmony features in Node.js

[2013-04-01] esnext, dev, nodejs, javascript
Quick tip (via David Klassen): The following shell command lists all (highly experimental!) ECMAScript Harmony [1] features that can be switched on in Node.js.
    node --v8-options | grep harmony

2013-03

Ecma wasn’t always Ecma

[2013-03-28] dev, javascript, jslang, jshistory
Most people know that ECMAScript is the language standard behind JavaScript [1]. Fewer people know that its name comes from Ecma International, the organization managing this standard. Interestingly, that organization started as “European Computer Manufacturers Association (ECMA)”, but renamed itself to “Ecma International” in 1994. That was done to reflect its increasingly international focus. Ecma is now not considered an acronym, any more. Ecma International is located in Geneva. In contrast, TC39 [1], the Ecma-hosted committee evolving ECMAScript, is rather USA-centric (true to where JavaScript was created and who created it) and usually meets somewhere in California.

Parallel JS (River Trail): soon in Firefox

[2013-03-24] dev, javascript
2013-12-23: A new blog post on ParallelJS (as Parallel JS is now called) supersedes this post.

Parallel JS will soon be included in Firefox Nightly builds. This project was initially called River Trail [1]. It automatically parallelizes code that uses the ParallelArray type and its array-like methods (map() etc.). [Source of this post: “Parallel JS lands” by Nicholas D. Matsakis.]