Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bbalconi/d9d64852ef38cd762037ea9026181c04 to your computer and use it in GitHub Desktop.
Save bbalconi/d9d64852ef38cd762037ea9026181c04 to your computer and use it in GitHub Desktop.
comparison 4 mikie
function breakOut (array, changeValue, stopValue) {
for (var i = 0; i < array.length; i++) {
if (array[i] !== stopValue) {
array[i] = changeValue
}
else break
}
return array
}
function breakOut(array, changeValue, stopValue) {
for (let i = 0, l = array.length; i < l; i++) {
if (array[i] === stopValue) {
break
}
array[i] = changeValue
}
return array
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment