Free email newsletter: “ES.next News

2013-06-30

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.

2013-06-26

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.

2013-06-22

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.

2013-06-20

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.

2013-06-19

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.

2013-06-14

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.

2013-06-11

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.

2013-06-08

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.

2013-06-06

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.

2013-06-04

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.