Object Oriented Programming in Javascript

You need to declare the class before use.

no need to use var, let or const for properties and no need to use function keyword for method

you can use #properties/method to make properties/method private i.e encapsulation

child classs mai private class ki properties access nhi kar sakte …

static method/properties to instance(object) kai uper call nhi kar sakte ye khud class kai user store ho jati hai

static method/properties ko access karne kai leye instance banane ki jarurat nhi hoti hai

static method sae static method/properties access kar rahe tab this keyword use kar sakte hai in other case ClassName.method/ ClassName.properties sae access karege

normal method kai andar sae static properties/ method ko access karne kai leye ClassName.method/ ClassName.properties sae access karege

Static Block Bhi bana sakte hai, iska code sirf aak hi bar run hoga first time jab static method call karge, next time sae static block ka code execute nhi hoga

Math.random(), Math.min() ye sab static method hai

static method/properties are used used in utils, config, id generation and so on ….

Leave a Comment