Skip to content

Instantly share code, notes, and snippets.

@robertknight
Created July 19, 2014 09:38
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 robertknight/746bc100c025b0bd218f to your computer and use it in GitHub Desktop.
Save robertknight/746bc100c025b0bd218f to your computer and use it in GitHub Desktop.
Firefox for-each behavior
var ary = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
for each (let v in ary) {
console.log('v is', typeof v, ary.indexOf(v));
ary.splice(ary.indexOf(v), 1);
}
console.log: 1pass-web: v is number 0
console.log: 1pass-web: v is number 1
console.log: 1pass-web: v is number 2
console.log: 1pass-web: v is number 3
console.log: 1pass-web: v is number 4
console.log: 1pass-web: v is number 5
console.log: 1pass-web: v is number 6
console.log: 1pass-web: v is number 7
console.log: 1pass-web: v is undefined -1
console.log: 1pass-web: v is undefined -1
console.log: 1pass-web: v is undefined -1
console.log: 1pass-web: v is undefined -1
console.log: 1pass-web: v is undefined -1
console.log: 1pass-web: v is undefined -1
console.log: 1pass-web: v is undefined -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment