Skip to content
Onsite

Output: a method extracted to a variable and called standalone

MediumP1Output

What does this code print?

1const user = {
2 label: 'Ann',
3 hi() {
4 console.log(this.label);
5 },
6};
7user.hi();
8const hi = user.hi;
9hi();
10user.hi.bind(user)();
Saved automatically

One line per console.log. Arrays as [1, 2, 3], objects as { a: 1 }, an uncaught error as Uncaught TypeError: message (Chrome and Node wording).

Hints

Saved automatically