Dark corners of JavaScript prototypes

18.08.2012

JavaScript

So I have this syntax highlighter written in JavaScript that uses a stack of parsing modes for its job. This is just a plain Array named modes, and the most common operation in my code is accessing the top element: modes[modes.length - 1] … which is kinda ugly, right? So ...