Skip to content

Instantly share code, notes, and snippets.

@frankzickert
Created July 19, 2019 13:22
Show Gist options
  • Save frankzickert/de730a268f8067217ff7ab1c312ece9f to your computer and use it in GitHub Desktop.
Save frankzickert/de730a268f8067217ff7ab1c312ece9f to your computer and use it in GitHub Desktop.
/** input array */
const arrInput = [1,4,2];
/** prepare an output array */
const arrOutput = new Array();
/** loop through the index of the input array */
for (var idx in arrInput) {
/** add to the output array ... */
arrOutput.push(
/** ... the value of the input array plus 2 */
arrInput[idx]+2
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment