js: binary search