Printing Markdown files on GitHub

GitHub displays Markdown files so nicely, it’s a shame there is no print view where all the toolbars etc. are hidden. Note that printing doesn’t necessarily mean that paper is involved. For example, on Mac OS X, you can print to PDF files.

This blog post explains three ways of printing Markdown files that are hosted on GitHub:


JavaScript gains support for SIMD

Update 2017-02-28: SIMD.js has been proposed as an ECMAScript feature and is currently at stage 3. The proposal is online.

Recently, a new JavaScript feature has landed for the next Firefox Nightly: an API for SIMD (Single Instruction, Multiple Data). This blog post explains how the API works and how it fits into the JavaScript landscape.


ECMAScript 6: the new array methods find() and findIndex()

Update 2014-05-08. Newer version of this post: “ECMAScript 6’s new array methods

Two new Array methods (proposed by Rick Waldron) are in the latest ECMAScript 6 specification draft:

This blog post describes them.


ParallelJS: data parallelism for JavaScript

Updates: JavaScript is still a very sequential language. That is slowly changing. This blog post describes ParallelJS, an effort to bring data parallelism to JavaScript.


Using strict mode in the Node.js REPL

If you want to use strict mode [1] in the Node.js REPL, you have two options.


Why are there so many array-like objects in the DOM?

Tweet by Leon Arnott:
#TIL the reason the DOM has so many "array-like objects" that aren't functional arrays… is because in Javascript 1.0, there were no arrays.


Initializing an array with values

It is not a frequent use case, but it comes up occasionally: Producing an array [1] of a given length that is filled with values. This blog post explains how to do it and what to watch out for.


ECMAScript 6 modules in future browsers

Update 2013-11-22: David Herman has published the slide deck “Status Report: ES6 Modules”.

[1] is an introduction to ECMAScript 6 modules and how they can be used in current browsers. In contrast, this blog post explains how future browsers will support them natively. As part of that support, we will get the <module> tag, a better version of the <script> tag.


Immediately invoked constructors and object literals

By now, you are probably familiar with immediately invoked function expressions (IIFEs, [1]). This blog post looks at immediately invoked constructors and immediately invoked object literals.


The history of “typeof null”

Update 2013-11-05: I take a look at the C code of typeof to better explain why typeof null results in 'object'.

In JavaScript, typeof null is 'object', which incorrectly suggests that null is an object (it isn’t, it’s a primitive value, consult my blog post on categorizing values for details). This is a bug and one that unfortunately can’t be fixed, because it would break existing code. Let’s explore the history of this bug.


The dict pattern: objects without prototypes are better maps

Using objects as maps from strings to values has several pitfalls. This blog post describes a pattern that eliminates some of them.


The JavaScript console API

In most JavaScript engines, there is a global object console with methods for logging and debugging. That object is not part of the language proper, but has become a de facto standard, since being pioneered by the Firebug debugger. Since their main purpose is debugging, the console methods will most frequently be used during development and rarely in deployed code.

This blog post gives an overview of the methods of console.


Safe integers in JavaScript

Update 2014-02-08: Follow-up blog post “What are integers in JavaScript?

JavaScript can only safely represent integers i in the range −253 < i < 253. This blog post examines why that is and what “safely represent” means. It is based on an email by Mark S. Miller to the es-discuss mailing list.


Tips for using window in JavaScript

In web browsers, window refers to an object that contains the global variables. This blog post explains how it works and when to use it.


Unicode and JavaScript

Update 2013-09-29: New sections 4.1 (“Matching any code unit”) and 4.2 (“Libraries”).

This blog post is a brief introduction to Unicode and how it is handled in JavaScript.


The ECMAScript Internationalization API

The ECMAScript Internationalization API is a standard JavaScript API that helps with tasks related to internationalization: collation, number formatting, date and time formatting. This blog post gives a brief overview and points to more reading material.


OS X: kill all Google Chrome tabs from the shell

If there are a lot of tabs open in Google Chrome, it tends to become slow. Killing tabs by hand, via the Task Manager helps, but is tedious. The following bash script (by Sindre Sorhus) lets you conveniently kill all open tabs from the shell (OS X only):


Data in prototype properties

Update 2013-09-14: New sections 1.2, 2 and 3.

This blog post explains when you should and should not put data in prototype properties.


JavaScript’s type system

This blog post examines JavaScript‘s type system. It answers questions such as: Is JavaScript dynamically typed? Weakly typed? What is coercion?


We need intelligence, not intellect

Quoting “Why Are Some People So Smart?” by MG Siegler:
If parents use IVF to conceive, then a genetic test—an extension of the screening tests for genetic diseases that are already routinely done on embryos—could let them pick the smartest genome from a batch of, say, 20 embryos.


Protecting objects in JavaScript

This blog post is a quick refresher of how objects can be protected in JavaScript. There are three levels of protection:
  1. Preventing extensions is the weakest level,
  2. sealing is stronger,
  3. freezing is strongest.


Why all objects are truthy in JavaScript

In JavaScript, all objects are truthy [1], even new Boolean(false), empty arrays and empty objects:
    > Boolean(new Boolean(false))
    > Boolean([])
    > Boolean({})
That is different from how objects are converted to number and string, where you can control the result by implementing the methods valueOf() and toString() [2].


Callable entities in ECMAScript 6

Update 2013-11-28: There won’t be generator arrow functions in ECMAScript 6 (details).

In ECMAScript 5, one creates all callable entities via functions. ECMAScript 6 has more constructs for doing so. This blog post describes them.


The flag /g of JavaScript’s regular expressions

This blog post describes when and how to use regular expressions whose flag /g is set and what can go wrong.
(If you want to read a more general introduction to regular expressions, consult [1].)


Directories for JavaScript resources

I recently asked on Twitter whether people knew any good directories for JavaScript libraries and got several good answers.


A meta style guide for JavaScript

JavaScript has many great style guides. Thus, there is no need to write yet another one. Instead, this blog post describes commonly accepted meta style rules and conventions that I like that are controversial. The idea is to help you make a more informed decision about what is right for you.


ECMAScript 6 modules: the future is now

Update 2014-09-07: Newer version of this blog post: “ECMAScript 6 modules: the final syntax”. Read it instead of this one.

This blog post first explains how modules work in ECMAScript 6, the next version of JavaScript. It then describes tools that allow you to already use them now.


In defense of JavaScript’s constructors

JavaScript’s constructors have never been particularly popular: Douglas Crockford doesn’t like them and recently, more anti-constructor material has been published (two examples: blog posts by Kyle Simpson and Eric Elliott).

In this blog post, I explain that not all of the constructors’ flaws are real. But even with those that are real, I still recommend to use them. I’ll tell you why and what the future holds for constructors.


Hello Polymer: Q&A with Google’s Polymer team

Today, there was an online event called “Hello Polymer”, in which Polymer team members Eric Bidelman, Alex Komoroske and Matthew McNulty talked about the framework. This blog post summarizes what happened.


Trailing commas in object literals and array literals

Quick reminder: trailing commas in object literals are legal in ECMAScript 5, trailing commas in arrays are ignored.


Performance optimizations and for loops

This blog post looks at two common performance optimizations for for loops. Are they really faster than the canonical version?


Array iteration and holes in JavaScript

The blog post describes how various functions and methods that deal with arrays are affected by holes [1].


Feeds (RSS, Atom) in the time of social media

These days, social media (Twitter, Facebook, Google+ etc.) seem much more popular than feeds (RSS, Atom). Google claims about the latter that their “usage has declined”. That begs the question: have social media made feeds irrelevant? This blog post answers that question with a firm “no” and explains why.


Iterators and generators in ECMAScript 6

[2015-02-26] New version of this blog post: “Iterables and iterators in ECMAScript 6

The iterator pattern enables unified and simple access to the elements stored in data structures. Generators are lightweight coroutines. Think: functions that can be suspended and resumed. Among other things, they help with implementing iterators.

This blog post explains how iterators and generators work in ECMAScript 6. The iterator protocol has recently changed, this post explains the new protocol.


Searching websites and evaluating JavaScript via Chrome’s omnibox

This blog post explains how to search several websites (not just a single search engine!) from the omnibox (address bar) in Google Chrome.


Basic JavaScript for the impatient programmer

Update: This blog post has become a chapter in my book “Speaking JavaScript”. You can read it here: “Basic JavaScript”.

Kind words by Cody Lindley (author of “jQuery Enlightenment”, “JavaScript Enlightenment” and “DOM Enlightenment”):
“Basic JavaScript” … [is the] most complete and concise write up I am aware of.

This blog post enables you to get started with JavaScript as quickly as possible – if you already know how to program. It describes the smallest subset of the language that allows you to be productive. I call that subset “Basic JavaScript” and recommend to program in it for a while, before moving on to more details and advanced topics. Learning everything at once is too confusing. The post concludes with tips for what to learn next.


Video: An overview of ECMAScript 6

On 2013-05-30, I held the talk “An overview of ECMAScript 6” at Fluent Conference, in San Francisco. The video is now publicly available (go there for a larger version of the video). And yes, I was slightly jet-lagged.


with makes it harder to evolve JavaScript

JavaScript’s with statement has been deprecated for a while [1]: it slows down your code and is forbidden in strict mode. Additionally, it makes it harder to evolve the language, because code that uses it is more brittle.


ECMAScript 6: automatically binding extracted methods

This blog post demonstrates how to use ECMAScript 6 proxies to automatically bind methods that are extracted from an object.


Do we really need privacy?

Due to the NSA spying program PRISM [1], we are again discussing the importance of privacy. People who don’t mind its current erosion have one compelling argument on their side: If spying – by whatever means – can prevent just a single terrorist attack then isn’t it worth it? This blog post mentions some of the risks of widespread spying.


Freezing instances and the first invoked constructor

Let’s say you want to write a constructor that produces instances that are frozen (immutable). One problem, you have to solve, is: when do you freeze this? If you always – unconditionally – perform the operation in the constructor then you can’t create sub-constructors that have their own instance properties. This blog post explains how to work around this problem.

Denying PRISM

I’m really not much of a conspiracy theorist, but “Triangulating on truth – the totalitarian state” (by Michael Arrington for Uncrunched) presents a good one:
On the Washington Post story [about the NSA spy program PRISM], that means one of these things must be true [emphasis is mine]:
  1. The NSA presentation is fake and the Washington Post got duped, or
  2. Microsoft, Yahoo, Google, Facebook, Apple, etc. are lying, or
  3. The presentation is real, and the companies are carefully drafting responses so that they aren’t technically lying.
I believe the third option above is truth.


Triggering events in vanilla JavaScript

So you want to trigger an event for a DOM element, without using jQuery? This blog post gives you a quick recipe for doing so.

The running example is about sending a submit event to a form. I needed to do that for a demo of user interface testing via CasperJS. And, unfortunately, the Form#submit method does not send that event on most web engines.


Running code fast in web browsers: PNaCl versus asm.js

The main point of the blog post “Thoughts on asm.js vs PNaCl” (by Gregg Tavares) is:
It just seems like asm.js and PNaCl are closer than people are admitting.
Some of the other points he is making are more controversial, so be sure to read the comments to get the complete picture.


JavaScript quirk 8: array-like objects

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

Some objects in JavaScript look like arrays, but aren’t. They are called array-like. This blog post looks at what exactly that means and how to best work with those objects.

Array-like objects

An array-like object
  • has: indexed access to elements and the property length that tells us how many elements the object has.
  • does not have: array methods such as push, forEach and indexOf.
Two examples of array-like objects is the result of the DOM method document.getElementsByClassName() (many DOM methods return array-like objects) and the special variable arguments [1]. You can determine the number of arguments via
And you can access a single argument, e.g. read the first argument:
Array methods, however, have to be borrowed. You can do that, because most of those methods are generic.

Generic methods

A generic method does not require this to be an array, it only requires this to have length and indexed element access. Normally, you invoke a method m on an array arr as follows.
 arr.m(arg0, arg1, ...)
All functions have a method call that allows you to perform the above invocation differently:
 Array.prototype.m.call(arr, arg0, arg1, ...)
The first argument of call is the value for this that m receives (in this case, arr). Because we access m directly and not via arr, we can now hand any this to that method. For example, arguments:
 Array.prototype.m.call(arguments, arg0, arg1, ...)


Let’s continue with a concrete example. The following function printArgs logs all arguments that it receives.
    function printArgs() {
            function (arg, i) {
                console.log(i+'. '+arg);
We have used method forEach generically. printArgs in use:
    > printArgs()
    > printArgs('a')
    0. a
    > printArgs('a', 'b')
    0. a
    1. b
You can even apply generic methods to ordinary objects:
    > var obj = {};
    > Array.prototype.push.call(obj, 'a');
    > obj
    { '0': 'a', length: 1 }
In the above case, property length did not exist and was automatically created, with the initial value zero.

Converting an array-like object to an array

Sometimes the best way to work with an array-like object is to convert it to an array. That can also be done via a generic method:
Compare: to create a copy of an array arr, you make the method call


  1. JavaScript quirk 5: parameter handling


The beginning of infinity in JavaScript

Infinity begins relatively early in JavaScript:
    > Math.pow(2, 1024)
    > Math.pow(2, 1023)
What is going on here?


Plans for supporting Web Components in AngularJS and Ember.js

Web Components [1] are an upcoming standard for custom HTML5 user interface elements. Those UI elements will eventually become interchangeable between frameworks. Now the people behind AngularJS and Ember.js have described their plans for supporting Web Components.

JavaScript quirk 7: inadvertent sharing of variables via closures

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

Closures are a powerful JavaScript feature: If a function leaves the place where it was created, it still has access to all variables that existed at that place. This blog post explains how closures work and why one has to be careful w.r.t. inadvertent sharing of variables.


Google’s Polymer and the future of web UI frameworks

Updates: At Google I/O 2013, Google presented a new web user interface (UI) framework called Polymer. The way it works is indicative of the future of all web UI frameworks.


JavaScript quirk 6: the scope of variables

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

In most programming languages, variables only exist within the block in which they have been declared. In JavaScript, they exist in the complete (innermost) surrounding function:

    function func(x) {
        console.log(tmp); // undefined
        if (x < 0) {
            var tmp = 100 - x;  // (*)


Netflix’s technology and hiring practices

In the article “Netflix, Reed Hastings Survive Missteps to Join Silicon Valley's Elite”, Ashlee Vance profiles Netflix and its CEO Hastings for Businessweek. The article mentions a few interesting tidbits about the company’s technology and hiring practices:


JavaScript history: undefined

Two tweets by Brendan Eich shed light on the history of JavaScript having both undefined and null [1].


Beyond “always on”

Current technology encourages us to be continuously connected. This blog post predicts that that will change.


Pets in wheelchairs

Cute: two pets lost their ability to use their hind legs, so their owners built them wheelchairs.


JavaScript quirk 5: parameter handling

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

The basics of parameter handling in JavaScript are simple, advanced tasks require manual work. This blog post first looks at the basics and then covers advanced topics.


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


Ecma wasn’t always Ecma

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


ECMAScript 6: TC39’s January 2013 meeting

TC39 [1] is the committe that currently plans ECMAScript 6 (code-named ECMAScript.next), the next version of the JavaScript language standard. January 29–31, they had another meeting. Thanks to Rick Waldron’s notes, we can read up on what has been decided. This blog post describes the highlights. Previous blog posts summarized prior meetings.

(Note: a blog post on the March TC39 meeting will be posted at some time in the future.)


Subclassing builtins in ECMAScript 6

[Update 2015-02-15] Newer version of this blog post: “Classes in ECMAScript 6 (final semantics)

In JavaScript, it is difficult to create sub-constructors of built-in constructors such as Array. This blog post explains the problem and possible solutions – including one that will probably be chosen by ECMAScript 6. The post is based on Allen Wirfs-Brock’s slides from a presentation he held on January 29, during a TC39 meeting.


Encoding permutations as integers via the Lehmer code (JavaScript)

This blog post explores the Lehmer code, a way of mapping integers to permutations. It can be used to compute a random permutation (by computing a random integer and mapping it to a permutation) and more.


JavaScript: try-finally

This blog post is a quick reminder of how try-finally works.


Will the term “web platform” replace “HTML5”?

When it comes to platforms for implementing applications, the term “web platform” seems to increasingly replace “HTML5” (which itself has largely replaced “Ajax” [1]). In this context, both terms denote the programming platform of web browsers. The former includes JavaScript. The latter doesn’t, strictly speaking, but it includes JavaScript-based APIs.


HTML5 context menus in the wild: Twitter’s “Follow” button

Twitter’s “Follow” button has an HTML5 context menu [1]. The button below allows you to try it out. On Firefox, you get a context menu whose top three items are “Follow”, “@rauschma on Twitter” and “Tweet to @rauschma”. Alas, other browsers don’t support the customization of context menus, yet.


ECMAScript 6’s parameter destructuring and forEach()

This blog post gives a brief introduction to destructuring in ECMAScript 6 and how the array method forEach() profits from it.


Perl and Python influences in JavaScript

If you search the Mozilla Central code base for the texts "Perl" and "Python" (don’t ignore case) then the comments mention what methods have been borrowed from those languages. The paths mentioned below are relative to /js/src/.
[Inspiration: a blog post by Ziyun Fei.]


Link-friendly content

Have you published a blog post or a GitHub project? This document gives tips for making your content appealing to link to. They are based on things I noticed while collecting material for the JavaScript Weekly email newsletter. The tips should also make your content more appealing to “normal” readers.


asm.js: closing the gap between JavaScript and native

Update 2013-12-30:

asm.js defines a subset of JavaScript that can be compiled to fast executables. It has been created at Mozilla by David Herman, Luke Wagner and Alon Zakai. According to the specification, “[asm.js] effectively describes a safe virtual machine for memory-unsafe languages like C or C++.” This blog post describes how asm.js works, it is based on the specification.


The Edge 2013 videos are online

Edge 2013 was a web development conference that took place on February 9, 2013, in London. Its approach was different from most conferences. Quoting the website:
Edge is a different kind of conference, for developers with experience to share, who want to see and bring improvements to the web platform. Our emphasis is on creating a good environment for productive debate and discussion, rather than presenting the experiences of a single speaker.

Each themed session is an hour long, and starts with a maximum 10 minute talk by an expert in that topic, outlining the current state of the platform in that area. [...] The remainder of the session will be given over to an open but structured discussion, with a professional moderator and a panel of seasoned developers who have in-depth knowledge of the subject. [...]

Session participants will include [...] a notetaker to record the discussion so we can share it on the web later.

Tweets with Internet Explorer usage statistics

People are posting Internet Explorer usage statistics on Twitter, tagged with #postyourIEstats (link works without being logged in). Summary:
  • IE6 is mostly dead, as it should be.
  • IE7 and IE8 still see considerable usage, but it’s on the decline.
  • IE9 is currently most popular. As of 2012-11-15, it is the oldest Internet Explorer still supported by Google.
  • IE10 usage is still low.


JavaScript’s regular expressions: more fun with XRegExp

Reminder: As soon as your JavaScript regular expressions become more complicated, you should probably use Steven Levithan’s XRegExp library. The cool thing about XRegExp is that it internally compiles its extended regular expressions to normal regular expressions, meaning that they are fast. Let’s look at some of XRegExp’s highlights, quoted from the XRegExp website.


Next from Apple: better information management?

At the moment, all desktop operating systems and all mobile operating systems are remarkably similar. Is there anything genuinely new that could be done in this space? Information management is an area that is still neglected – especially by Apple. But signs indicate that that might change.


Learning JavaScript via other languages

Looking back on my life, three programming languages prepared me well for JavaScript (which has some challenging aspects):


JavaScript: fixing categorization

Categorizing values in JavaScript is quirky. This blog post explains the quirks and one approach to fixing them. To understand everything, it helps to be familiar with how values are categorized in JavaScript. If you aren’t, consult [1].


A pet squirrel

Have you had your daily dose of cute already? If not, then look no further. The picture below is one of several.


parseInt() doesn’t always correctly convert to integer

In JavaScript, all numbers are floating point. Integers are floating point numbers without a fraction. Converting a number n to an integer means finding the integer that is “closest” to n (where “closest” is a matter of definition). You might think that parseInt() performs this task, but it doesn’t. At least, not always.


JavaScripts 12 größte Fallgruben

[Dieser Blogpost ist die Langversion eines Artikels im CHIP Web Design 2013.]

JavaScript ist eigentlich eine recht kompakte Sprache. Wenn es nur nicht all diese Fallgruben gäbe... Dieser Artikel erklärt die 12 größten und wie man am besten mit ihnen umgeht. Zur Lektüre werden grundlegende JavaScript-Kenntnisse vorausgesetzt. Wir halten uns an die aktuelle Version von JavaScript, ECMAScript 5.


Chromebooks and netbooks

The best-selling laptop on Amazon? A Chromebook [1]! Quoting “Amazon's top selling laptop doesn't run Windows or Mac OS, it runs Linux” (by Steven J. Vaughan-Nichols for ZDNet):
So, what, according to Amazon, in this winter of Windows 8 discontent has been the best selling laptop? It's Samsung's ARM-powered, Linux-based Chromebook.


Web development: 2012 & forward

Functionn is a blog on open source web development. Today, they published an interview with me and several other people (including DailyJS’s Alex R. Young) covering various web-development-related topics. They asked the following questions:


Categorizing values in JavaScript

This post examines four ways in which values can be categorized in JavaScript: via the hidden property [[Class]], via the typeof operator, via the instanceof operator and via the function Array.isArray(). We’ll also look at the prototype objects of built-in constructors, which produce unexpected categorization results.


Responsive web design versus adaptive web design

This blog post looks at the difference between responsive web design and adaptive web design. Before we can get started, we need to define another concept: progressive enhancement.


Graph search: Facebook as a database

Today, Facebook introduced a new feature called “graph search”. This blog post explains what it is. It is based on the Verge’s liveblog of the event.


ECMAScript.next: TC39’s November 2012 meeting

From November 27-29, 2012, the Ecma Technical Committee 39 (TC39, [1]) had another meeting, where decisions were made about ECMAScript.next (the code name for ECMAScript 6 [1]). This blog post summarizes and explains the highlights. It is based on Rick Waldrons excellent notes that he put up on GitHub. There is also a list of all 2ality posts on TC39 meetings.


What temperature has the same degrees in Celsius and Fahrenheit?

Idle question of the day: What temperature has the same degrees in Celsius and Fahrenheit?


ECMAScript.next: array comprehensions and generator comprehensions

Update 2014-08-04: Comprehensions won’t be in ECMAScript 6. There’s a chance that an updated version of them will be in ECMAScript 7 or later.

ECMAScript.next will have two kinds of comprehensions: array comprehensions and generator comprehensions. They allow one to quickly assemble an array or a sequence of elements. Comprehensions exist in many programming languages, for example: CoffeeScript, Python, Haskell, Clojure.


Brace styles and JavaScript

In languages whose syntax is derived from C (e.g.: C ← C++ ← Java ← JavaScript), two brace styles are most common: Allman style and 1TBS.


JavaScript terminology: the two prototypes

In JavaScript, there is an unfortunate overloading of the term “prototype”.