Javascript Remove Characters From End Of String