2012-02

Major and minor JavaScript pitfalls and ECMAScript 6

[2012-02-23] esnext, dev, javascript, jslang
Update 2012-02-24: New content in sections
  • 2.1. Function-scoped variables
  • 2.2. Inadvertent sharing via a closure
  • 2.7. for...in is weird

JavaScript has many pitfalls. This post examines whether they make JavaScript “unfixable” as a language – as some argue. To do so, it separates the pitfalls into two categories: The ones that become harmless after learning about them and the ones that don’t. We’ll also look at how the upcoming ECMAScript 6 fixes most problems.

Warning: If you are new to JavaScript then don’t let this post be your introduction to it. Consult other material first.

Twitter to eliminate their hashbang (#!) URLs

[2012-02-21] app urls, browser, dev, twitter, webdev, computers
In a conversation triggered by Tim Haines, Twitter front end engineer Dan Webb refers to his article “It's About The Hashbangs” on the problems of using #! URLs in JavaScript. He then goes on to confirm:

Integers and shift operators in JavaScript

[2012-02-20] bitwise_ops, numbers, dev, javascript, jsint, jslang
JavaScript only has floating point numbers. This post explains how integer operations are handled, specifically the bit shift operations. It will also answer the question whether n >>> 0 is a good way of converting a number to a non-negative integer.

Transforming HTML with Node.js and jQuery

[2012-02-17] jsshell, jquery, dev, nodejs, javascript, jsdom
The npm module jsdom enables you to use jQuery to examine and transform HTML on Node.js. This post explains how.

NaN and Infinity in JavaScript

[2012-02-13] numbers, dev, javascript, jslang
Update: New section “Detecting NaN”.

This post looks at two special values that can be the result of operations that normally return numbers: NaN and Infinity.

Taming tabs and bookmarks

[2012-02-10] browser, info mgmt, firefox, computers
Tabs were a major usability advancement for web browsers. They make it much easier to work with multiple locations at the same time and the ability to open links “in the background” turns them into a to-do list for pages that one still wants to read. However, before long, tabs also exhibit the negative traits of to-do lists: There are too many things still to consider and everything grows stale. This post presents ideas for how to tame tabs, for how to avoid those traits. Some of the ideas can be put into practice right now, others are about improving browsers and making a mental shift to fully exploit those improvements.

Exemplar patterns in JavaScript

[2012-02-06] dev, javascript, jslang
This post explores exemplars (factories for objects) and how to implement them. The term exemplar has been proposed by Allen Wirfs-Brock to avoid the term class, which is not a good fit for JavaScript: Exemplars are similar to classes, but they are not classes.

PDF.js: display PDF files in your browser, without native code

[2012-02-04] browser, library, dev, firefox, javascript, computers, pdf
Quite amazing: PDF.js is a JavaScript library that displays PDFs in browsers. At version 0.2, it comes with the requisite warning: “Note: This is an early-stage prototype. Several documents might not render properly.”

Servo: a vision for the future of Firefox

[2012-02-02] rust, dev, firefox, computers, servo, mozilla
Updates:
  • 2012-06-28: Restructured much of the content, to make it easier to digest.
  • 2012-06-27: New section “More information on Servo”.
Recently, Mozilla stopped the Electrolysis project [1] that was to give Firefox per-tab processes. Hence, I was relieved when David Bruant pointed out to me that Mozilla haven’t given up on a parallel browser. They are working on a project called Servo which is being implemented in the Rust programming language.

2012-01

What is {} + {} in JavaScript?

[2012-01-29] dev, javascript, jslang
Recently, the lightning talk “Wat” by Gary Bernhardt pointed out an interesting JavaScript quirk: You get unexpected results when you add objects and/or arrays. This post explains those results.