Skip to content

Instantly share code, notes, and snippets.

@scriptschat
Created September 22, 2020 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scriptschat/b32af46f694b2ad3dc5d18a7010972b4 to your computer and use it in GitHub Desktop.
Save scriptschat/b32af46f694b2ad3dc5d18a7010972b4 to your computer and use it in GitHub Desktop.
Using for in construct with an Array
const fruits = ['apple', 'orange', 'kiwi', 'grapes', 'pineapple'];
fruits.code = 'is crazy';
for(e in fruits) {
console.log(e);
}
//Output
// 0
// 1
// 2
// 3
// 4
// code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment