Skip to content

Commit b37f07b

Browse files
committed
Updated WeakMap example to actually increment age
1 parent c1e78ac commit b37f07b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,8 @@ class Person {
648648
}
649649

650650
incrementAge() {
651-
let age = _age.get(this);
651+
let age = _age.get(this) + 1;
652+
_age.set(this, age);
652653
if(age > 50) {
653654
console.log('Midlife crisis');
654655
}

0 commit comments

Comments
 (0)