Skip to content

Instantly share code, notes, and snippets.

@AnnemarieWegley
Created June 16, 2014 14:07
Show Gist options
  • Save AnnemarieWegley/1df39f803fd1c4190d61 to your computer and use it in GitHub Desktop.
Save AnnemarieWegley/1df39f803fd1c4190d61 to your computer and use it in GitHub Desktop.
<script>
function Money() {
this.coins = [];
this.count = function() {
return this.coins.length;
}
this.init = function() {
for (a = 1; a <= 25; a++) {
for (t = 1; t <= 4; t++) {
this.coins.push(new Coin(a, t));
}
}
}
}
function Coin(amount, type) {
this.amount = amount;
this.type = type;
this.show = function() {
console.log(this.amount + " of " + this.type);
}
}
m = new Money();
m.init();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment