Skip to content

Commit 504566a

Browse files
author
Em01
committed
more objects
1 parent 25ac6d6 commit 504566a

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

objectOriented/accessors.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,14 @@ var count = 0;
1414

1515
for (var i = 1; i< 100; i++) {
1616
count += bar;
17+
}
18+
19+
20+
21+
22+
function listGuns(guns) {
23+
for (var speargun in guns) {
24+
console.log("Behold! " + speargun + ", with " +
25+
guns[speargun]["heft"] + " heft!");
26+
}
1727
}

objectOriented/enumeration.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
aquarium.countFish = function(){
2+
var numFish = 0;
3+
for ( key in aquarium ) {
4+
if ( aquarium[key].type == "fish") {
5+
numFish++;
6+
}
7+
}
8+
return numFish;
9+
};

0 commit comments

Comments
 (0)