Objects, prototypes, and this

Which object does this refer to inside label?

Examples

Worked example

Input
const read = book.label.bind(book); read()
Expected output
book

Hints and solution

Hint 1

Write down the starting state and walk through one example by hand.

Reveal worked answer

Binding creates a function that calls the target with book as its receiver.

Back to the lesson