Static range trees in JavaScript