javascript break out of foreach early