- 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.
- 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
team: fatima , harith riyadh, ahmed rashed, hande nur demirbay
1-allows for code reusability, as code can be written in a modular manner and can be reused in other parts of the application.
2-Singleton Pattern , Factory Pattern, Observer Pattern, Adapter Pattern,Decorator Pattern
3-Classical Inheritance:a subclass can inherit properties and methods from a superclass.
protptypal : objects are created first, and then other objects are created by cloning or inheriting from them.
4- a class is defined using the class keyword.allows for code reusability, as code can be written in a modular manner and can be reused in other parts of the application.
5-constructors and prototypes work together to create and define the properties and behaviors of objects in JavaScript. Constructors are used to create new objects, while prototypes are used to define their properties and methods.