Skip to content

Commit 54da31a

Browse files
committed
fixed code
1 parent f05375c commit 54da31a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

chapter06/01-Set.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ function Set() {
5050
this.sizeLegacy = function(){
5151
var count = 0;
5252
for(var prop in items) {
53-
++count;
53+
if(items.hasOwnProperty(prop))
54+
++count;
5455
}
5556
return count;
5657
};

chapter07/01-Dictionaries.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ function Dictionary(){
1515
};
1616

1717
this.has = function(key){
18-
return key in items;
18+
return items.hasOwnProperty(value);
19+
//return value in items;
1920
};
2021

2122
this.get = function(key) {

0 commit comments

Comments
 (0)