[js] test out of bounds and undefined idx arguments