2013-12

JavaScript gains support for SIMD

[2013-12-28] jsfuture, asmjs, dev, javascript, concurrency
Update 2017-05-08: a proposal for SIMD.js has been rejected, in favor of providing similar functionality via WebAssembly.

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

[2013-12-25] esnext, dev, javascript
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

[2013-12-23] jsfuture, dev, javascript, concurrency
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

[2013-12-20] dev, nodejs, javascript
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?

[2013-12-08] dev, javascript, clientjs, jshistory
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.

2013-11

Initializing an array with values

[2013-11-23] dev, javascript, jslang, jsarrays
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

[2013-11-19] esnext, dev, javascript, jsmodules, clientjs
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

[2013-11-08] dev, javascript, jslang
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.

2013-10

The history of “typeof null”

[2013-10-29] dev, javascript, jslang, jshistory
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

[2013-10-14] dev, javascript, jslang
Using objects as maps from strings to values has several pitfalls. This blog post describes a pattern that eliminates some of them.