js-test-5

Are there any issues with the getId function? What will be logged to the screen?

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

So, getId is an arrow function, thus it doesn’t have this of its own.

It’s not bound to this of the obj object and when we try to get this.id it will be evaluated to undefined and not 1.


ANSWER: undefined will be logged to the console.