Posts

Showing posts from January, 2015

New string features in ECMAScript 6

Image
The blog post covers new features of strings in ECMAScript 6 (ES6). Unicode code point escapes Unicode “characters” (code points) are 21 bit long [2] . JavaScript strings are (roughly) sequences of 16 bit characters, encoded as UTF-16. Therefore, code points beyond the first 16 bits of the code point range (the Basic Multilingual Pane , BMP) are represented by two JavaScript characters. Until now, if you wanted to specify such code points via numbers, you needed two so-called Unicode escapes . As an example, the following statement prints a rocket (code point 0x1F680) to most consoles: console.log('\uD83D\uDE80'); In ECMAScript 6, there is a new kind of Unicode escape that lets you specify any code point: console.log('\u{1F680}'); String interpolation, multi-line string literals and raw string literals Template strings [3] provide three interesting features. First, template strings support string interpolation: let first = 'Jane'; let last = 

Into Night: A Reflection On Teaching Praxis

Image
Sam was a kid in my seventh grade English class and one of several Jewish students enrolled at this private Catholic school in Los Angeles.   In fact, more than half the kids in the school were of different faiths than the one professed by the Marianist founders.   Even though I did not teach religion, I considered integrating the point of view of different faiths into our study of literature to be a positive part of my classroom praxis.   Sam had distinguished himself as an excellent student who excelled at writing and always had insightful, if very serious comments to offer during class discussion.   His work was consistently far above middle school level.   Although he listened attentively during class when those of other religions discussed their faith views, he never commented directly based on his Jewish experience. One work of literature we covered that year was Elie Wiesel’s memoir, Night (Hill and Wang, 2006), about the author’s experience as a twelve-year old boy in a conce

New frontend framework “Aurelia”: Web Components, 6to5, jspm, MVVM

Aurelia is a new framework by Durandal creator Rob Eisenberg (which helps credibility-wise). It uses an interesting combination of technologies/techniques: Web Components: as an infrastructure for widgets (polyfilled where necessary) 6to5 : to compile ECMAScript 6 to ECMAScript 5 jspm : for package management MVVM (as used by Knockout and the Knockout-inspired Durandal): as a UI pattern jspm is currently based on Traceur, support for 6to5 is work in progress . Quoting Eisenberg on how Aurelia combines 6to5 and jspm: There is work on system.js currently to decouple it from traceur and allow the use of 6to5 instead. Note that it only loads traceur if you are feeding it actual es6 code that hasn’t been transpiled. Since aurelia is transpiled and the skeleton is set up to use 6to5…system.js actually never loads traceur and it never comes into play. I haven’t used Aurelia, yet. Opinions welcome.

Destructuring and parameter handling in ECMAScript 6

This blog post is outdated. Please read the following two chapters in “Exploring ES6”: Destructuring Parameter handling ECMAScript 6 (ES6) supports destructuring , a convenient way to extract values from data stored in (possibly nested) objects and arrays. This blog post describes how it works and gives examples of its usefulness. Additionally, parameter handling receives a significant upgrade in ES6: it becomes similar to and supports destructuring, which is why it is explained here, too. Destructuring In locations that receive data (such as the left-hand side of an assignment), destructuring lets you use patterns to extract parts of that data. In the following example, we use destructuring in a variable declaration (line (A)). It declares the variables f and l and assigns them the values 'Jane' and 'Doe' . let obj = { first: 'Jane', last: 'Doe' }; let { first: f, last: l } = obj; // (A) // f = 'Jane'; l = 'Doe' Destr