How To Exit For Loop Javascript Mdn