javascript string replace from index to end