File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
data-structures-in-javascript Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ class HashTable {
18
18
19
19
remove ( key ) {
20
20
const hash = this . calculateHash ( key ) ;
21
- if ( this . values . hasOwnProperty ( hash ) && this . values [ hash ] . hasOwnProperty ( key ) ) {
21
+ if ( this . values . hasOwnProperty ( hash ) && this . values [ hash ] . hasOwnProperty ( key ) ) {
22
22
delete this . values [ hash ] [ key ] ;
23
23
this . numberOfValues -- ;
24
24
}
@@ -30,7 +30,7 @@ class HashTable {
30
30
31
31
search ( key ) {
32
32
const hash = this . calculateHash ( key ) ;
33
- if ( this . values . hasOwnProperty ( hash ) && this . values [ hash ] . hasOwnProperty ( key ) ) {
33
+ if ( this . values . hasOwnProperty ( hash ) && this . values [ hash ] . hasOwnProperty ( key ) ) {
34
34
return this . values [ hash ] [ key ] ;
35
35
} else {
36
36
return null ;
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ HashTable.prototype.add = function(key, value) {
16
16
} ;
17
17
HashTable . prototype . remove = function ( key ) {
18
18
var hash = this . calculateHash ( key ) ;
19
- if ( this . values . hasOwnProperty ( hash ) && this . values [ hash ] . hasOwnProperty ( key ) ) {
19
+ if ( this . values . hasOwnProperty ( hash ) && this . values [ hash ] . hasOwnProperty ( key ) ) {
20
20
delete this . values [ hash ] [ key ] ;
21
21
this . numberOfValues -- ;
22
22
}
@@ -26,7 +26,7 @@ HashTable.prototype.calculateHash = function(key) {
26
26
} ;
27
27
HashTable . prototype . search = function ( key ) {
28
28
var hash = this . calculateHash ( key ) ;
29
- if ( this . values . hasOwnProperty ( hash ) && this . values [ hash ] . hasOwnProperty ( key ) ) {
29
+ if ( this . values . hasOwnProperty ( hash ) && this . values [ hash ] . hasOwnProperty ( key ) ) {
30
30
return this . values [ hash ] [ key ] ;
31
31
} else {
32
32
return null ;
You can’t perform that action at this time.
0 commit comments