- What are some advantages of using object-oriented programming (OOP) in JavaScript, and how does it differ from other programming paradigms?
- What are some common design patterns used in object-oriented programming, and how can they help to solve recurring software development problems?
- Can you explain the difference between classical inheritance and prototypal inheritance in JavaScript, and provide some examples of each?
- How do you define a class in JavaScript, and what are some best practices for creating and using classes effectively?
- What is the role of constructors and prototypes in OOP in JavaScript, and how do they relate to each other?
Created
March 31, 2023 22:52
-
-
Save Kishimoto96/2a4a8c96630887e4a8f9940db41240e4 to your computer and use it in GitHub Desktop.
TasneemAkkad
commented
Apr 1, 2023
- there are a lot of them some of them are singleton, Factory, Observer, Decorator, and Adapter patterns, we use them to solve recurring software development problems. some of them provide a proven solution to common problems and make code more flexible, maintainable, and extensible also these patterns can help developers save time and effort, improve code quality, and create more robust and scalable software applications.
- In classical inheritance, classes are defined using a blueprint or template, and objects are created from these classes using the new keyword, n prototypal inheritance, objects inherit properties and methods directly from other objects. There are no classes, and objects are created using constructor functions or object literals.
- In JS, classes can be defined using the class keyword, it can help you organize and structure your code in a more object-oriented way
- The prototype is the base class, the constructor your current class. In OOP the above would be class Foo extends Function You can also start inheritance with this entire setup of prototype and constructor making more complex objects as you go whilst sharing functionality.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment