Searching using Array.prototype.reduce

.

Searching for a particular element in a JavaScript array is often carried out using a typical iteration. In some cases, forEach and some can be used as well. What is often overlooked is the potential use of Array.prototype.reduce to perform such an operation. ECMAScript 5.1 specification, in Section 15.4.4.21, describes the callback function to reduce… Read more »

Code Coverage of Jasmine Tests using Istanbul and Karma

.

For modern web application development, having dozens of unit tests is not enough anymore. The actual code coverage of those tests would reveal if the application is thoroughly stressed or not. For tests written using the famous Jasmine test library, an easy way to have the coverage report is via Istanbul and Karma. For this… Read more »

Scope Analysis for JavaScript Code

.

Walking the syntax tree of a JavaScript code is often the first step towards building a specialized static analyzer. In some cases however, when the analysis involves variables and functions within the code, an additional scope analysis is necessary. This permits a more thorough examination of those variables and functions, including to check if some… Read more »

Autumn 2013 Conferences

.

Summer is almost over, fall is around the corner. I’ll hit the road again, this time I plan to be in New York, Los Altos, and San Jose. In just a few days (Sep 23), there is Edge NYC 2013 where I join the Rendering Performance panel. Edge is a quite popular high-quality web conference… Read more »

2013 Nexus 7 JavaScript Performance Quick Check

.

The second generation Nexus 7, revealed a few weeks ago, is a good refresh of this popular Android tablet. Beside the much improved display density (going to 323 ppi from 216 ppi), this All-New Nexus 7 also has a different SoC. If this tablet is used mainly for browsing the web, how does it perform… Read more »

Searching with Array.prototype.some

.

Iterating over an array to search for an item is a pretty common task. With JavaScript, Array.prototype.forEach is often the popular choice. In some cases however, Array.prototype.some can be a better fit for the job if there is no need to search the entire array once a condition is fulfilled. There are at least three… Read more »