Please enable JavaScript.
Coggle requires JavaScript to display documents.
OOP in JavaScript - Coggle Diagram
OOP in JavaScript
🔷 What is OOP?
Uses objects with:
Properties (key-value data)
Methods (functions for behavior)
JS uses prototypes, not classical inheritance
🔷 Creating Objects (Function Style)
Use function to return object
Assign properties with this
Each call returns a new object
🔷 this Keyword
Refers to caller object
Global context → window
Method call → object
setTimeout → window
🔷 Classes in JS
class + constructor
Methods inside class
Use new to create instance
🔷 Inheritance (extends)
ChildClass extends ParentClass
Use super() in constructor