Last active
January 20, 2025 11:34
-
-
Save jonurry/6113de501d42ac397c6d49008ffb1844 to your computer and use it in GitHub Desktop.
6.4 Borrowing a Method (Eloquent JavaScript Solutions)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let map = {one: true, two: true, hasOwnProperty: true}; | |
| // Fix this call | |
| //console.log(map.hasOwnProperty("one")); | |
| console.log(hasOwnProperty.call(map, 'one')); | |
| // → true |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hints
Remember that methods that exist on plain objects come from
Object.prototype.And that you can call a function with a specific
thisbinding by using itscallmethod.