2012-04

ECMAScript 6: arrow functions and method definitions

[2012-04-12] esnext, dev, javascript
Follow-up blog post from 2013-08-11:Callable entities in ECMAScript 6”.

In JavaScript, one aspect of creating a function inside a method is difficult to get right: handling the special variable this. ECMAScript.next will make things easy by introducing two constructs: arrow functions and method definitions. This blog posts explains what they are and how they help.

Handing variables to eval

[2012-04-04] eval, dev, javascript, jslang
Problem: You have an object that assigns values to names and want to use those names in an expression that is to be evaluated by eval. The classic solution is to use the with statement. But that statement is deprecated [1], starting with ECMAScript 5 strict mode [2]. This blog post describes an alternative implementation technique.

2012-03

Converting a value to string in JavaScript

[2012-03-29] dev, javascript, jslang
In JavaScript, there are three main ways in which any value can be converted to a string. This blog post explains each way, along with its advantages and disadvantages.

CSS Grid Layout is coming to Firefox in 2012

[2012-03-26] dev, firefox, webdev, layout

JavaScript’s two zeros

[2012-03-23] numbers, dev, javascript, jslang
JavaScript has two zeros: −0 and +0. This post explains why that is and where it matters in practice.

What are the most popular JavaScript keywords?

[2012-03-18] dev, javascript, jslang
Ariya Hidayat has used is Esprima parser to count the most popular keywords in a corpus of JavaScript libraries.

Stricter equality in JavaScript

[2012-03-14] dev, javascript, jslang
Update 2012-11-08: The is operator will not be added to ECMAScript (probably ever). But this article is still relevant, because Object.is() will be part of ECMAScript 6 and because it sheds light on how === works.

Most JavaScript programmers are aware that “normal” equality (==) should be avoided in favor of strict equality (===) [1]. However, every now and then you need something even stricter than ===: If you want to check for NaN or if you want to distinguish between -0 and +0. This blog post explains the details and ECMAScript.next’s [2] solution, the “is” operator.

Displaying numbers in JavaScript

[2012-03-12] numbers, dev, javascript, jslang
This blog post explains how JavaScript displays numbers. It also examines when JavaScript uses exponential notation and when it uses fixed notation.

The jQuery Foundation has been created

[2012-03-07] jquery, dev, javascript, clientjs
jQuery has previously been managed by a board that was part of the Software Freedom Conservancy. Now an independent foundation has been created to perform that task.

Private data for objects in JavaScript

[2012-03-03] esnext, dev, javascript, jslang
Update 2012-10-21: In September 2012, The term “private name object” has been changed to “private symbol”.

JavaScript does not come with dedicated means for managing private data for an object. This post describes five techniques for working around that limitation: