const child = Object.create(parent). child inherits all properties from parent. This is direct object-to-object inheritance without constructors or classes. Useful for simple prototypal patterns.
How do you use Object.create for prototypal inheritance in JavaScript?
More FAQs in Prototype: Real-World Examples in JavaScript
All arrays inherit from Array.prototype. When you call arr.map(fn), JS looks for map on arr, doesn't find it, then finds it on Array.prototype. This is how all arrays share the same methods (map, filter, reduce, etc.).
A mixin is an object with methods that can be mixed into other objects: Object.assign(MyClass.prototype, SerializableMixin). This adds the mixin's methods to the class's prototype. It is composition over inheritance.
class ApiClient { get(path) {} } puts get on ApiClient.prototype. All instances (new ApiClient()) inherit get from the prototype. This is memory-efficient: one get function shared by all instances.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.