Win a ticket for Fluent Conference

Update 2013-05-03: A winner has been determined and received the ticket.

Fluent Conference takes place in San Francisco from May 28–30, 2013. Its tag line is “JavaScript & Beyond”. The 2ality blog raffles off a ticket for the last two days (excluding the workshop day). To win, tweet the following text:

I’d like to win a ticket for Fluent Conference. #2alityFluent
The deadline is Friday, May 3rd, 2013, 14:00 GMT. I’ll contact the winner via Twitter, within a few hours of the deadline. (If the winner isn’t following me already, I’ll ask them to temporarily do so, so that I can send them a direct message.)

[Legal disclaimer: I make no guarantees w.r.t. to there being a winner. Contesting this raffle via legal means is not allowed.]


JavaScript quirk 4: unknown variable names create global variables

[This post is part of a series on JavaScript quirks.]

Normally, JavaScript automatically creates a global variable if you use an unknown variable name:

    > function f() { foo = 123 }
    > f()
    > foo
Thankfully, you get a warning in ECMAScript 5 strict mode [1]:
    > function f() { 'use strict'; foo = 123 }
    > f()
    ReferenceError: foo is not defined
  1. JavaScript’s strict mode: a summary


JavaScript quirk 3: normal equality (==)

[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

There are several ways of checking whether a variable has the value undefined. This blog post explains the differences.


News is bad for you

Quoting “News is bad for you – and giving up reading it will make you happier” (by Rolf Dobelli for The Guardian):
In the past few decades, the fortunate among us have recognised the hazards of living with an overabundance of food (obesity, diabetes) and have started to change our diets. But most of us do not yet understand that news is to the mind what sugar is to the body. News is easy to digest. The media feeds us small bites of trivial matter, tidbits that don't really concern our lives and don't require thinking.


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

[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.


[Sponsor] Where are JavaScript and the web going?

The Fluent conference co-chairs look ahead.

[A blog post by Simon St. Laurent, originally published on the O'Reilly Programming Blog, republished with permission.]

JavaScript and HTML5 just keep moving. One day it’s form validation, the next animation. Then it becomes full-on model view controller stacks getting data from sensors on devices and communicating with back-end servers that are themselves largely JavaScript.

Peter Cooper and I have tried to capture some of this power in the upcoming Fluent conference, so that attendees can find their ways to the tools that work for them. Early registration for Fluent ends April 10. To get a 20% discount, use the registration code “2ALITY”.


JavaScript quirk 1: implicit conversion of values

[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'
    > '5' * '2'
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.

12 JavaScript quirks

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:


Google’s Blink: a few interesting facts

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()

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

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