Towards ECMAScript 6 with Esprima 2

Posted by & filed under Uncategorized.

Little did I know that the start of my adventure with Esprima three years ago will result in something beyond my expectation. While the syntax tree format used by Esprima is not original (see SpiderMonkey Parser API), this de-facto format gains a lot of traction since it provokes a Cambrian explosion of composable JavaScript language… Read more »

ECMAScript 6 and Proxy

Posted by & filed under Uncategorized.

Being able to intercept a certain operation to an object can be really useful, in particular during a troubleshooting session. With ECMAScript 6, this is possible via its new feature, proxy. Creating a proxy on a particular object allows a predefined handler to get notified when something happens. In the latest draft specification (Rev 15,… Read more »

ECMAScript 6 and Block Scope

Posted by & filed under Uncategorized.

Until today, JavaScript comes with a function-level scope for variables and functions. This quirk often trips beginners who are already familiar with other curly braces language. With ECMAScript 6, the situation will change with the availability of the well-understood block scope. Function-level scope leads to a situation called hoisting. For example, for this code: function… Read more »

ECMAScript 6 and Method Definitions

Posted by & filed under Uncategorized.

Using an object literal populated with some member functions is a common practice in any serious JavaScript applications. This is also useful for all kind of frameworks, in particular to setup object prototypes. The upcoming ECMAScript 6 introduces method definition, a nice shorthand which eliminates the need to use function when using that pattern. Before… Read more »

ECMAScript 6 and Spread Operator

Posted by & filed under Uncategorized.

We have seen how a rest parameter can help the handling of a variable number of function arguments. What about the other way around? Can we turn an array into a series of function arguments? Apparently, ECMAScript 6 defines a new type of operator called the spread operator which does exactly that. Let us review… Read more »

ECMAScript 6 and Rest Parameter

Posted by & filed under Uncategorized.

Handling a function with a variable number of arguments is always tricky in JavaScript. At least, we still have this arguments object which can be used to retrieve all arguments used to invoke a function. With the upcoming ECMAScript 6, no such hack is necessary anymore since we can start using its rest parameter feature…. Read more »