Skip to content

Instantly share code, notes, and snippets.

@devongovett
Created July 17, 2010 20:25
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 devongovett/479827 to your computer and use it in GitHub Desktop.
Save devongovett/479827 to your computer and use it in GitHub Desktop.
__hasProp: true
yearsOld: {max: 10, ida: 9, tim: 11}
ages: for child, age of yearsOld
child + " is " + age
# compiles into this JavaScript, which will not work
var _a, _b, age, ages, child, yearsOld;
var __hasProp = Object.prototype.hasOwnProperty;
__hasProp = true;
yearsOld = {
max: 10,
ida: 9,
tim: 11
};
ages = (function() {
_a = []; _b = yearsOld;
for (child in _b) { if (__hasProp.call(_b, child)) {
age = _b[child];
_a.push(child + " is " + age);
}}
return _a;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment