Question · JavaScript and TypeScript course · Module 2: Functions, Arrays and Objects
Prototype Chain
What happens when you try to access a property that the object doesn't have?
Answer options
- JavaScript returns an empty value 0
- JavaScript automatically creates the property with a null value
- JavaScript searches for the property in the object's prototype chain
- JavaScript throws a TypeError
Show the answer
Correct answer:
- JavaScript searches for the property in the object's prototype chain