Btrees in Javascript