0% found this document useful (0 votes)
3 views8 pages

Day 16

rew46hyiuyujunfhgfhgb

Uploaded by

ashleshadimpal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views8 pages

Day 16

rew46hyiuyujunfhgfhgb

Uploaded by

ashleshadimpal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Object-oriented programming

Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects." Objects are entities that combine data
(properties) and behavior (methods) into a single unit. This makes it possible to create modular and reusable code.
JavaScript is a prototype-based language, which means that it doesn't have classes in the traditional sense. Instead, objects are created
based on prototypes, which are blueprints that define the properties and methods of an object.
Here are some of the key concepts of OOP in JavaScript:
Constructors
Constructors are functions that are used to create new objects. They can be used to initialize the properties of an object and to set its initial
state.
Object-oriented programming

Prototypes
Prototypes are objects that serve as blueprints for other objects. When a new object is created, it inherits the properties
and methods of its prototype. This allows you to share code between objects without having to duplicate it.
Object-oriented programming

Inheritance
Inheritance is a way of creating
new classes based on existing
classes. The new class inherits the
properties and methods of the
parent class, and it can also add its
own properties and methods.
Object-oriented programming

Encapsulation
Encapsulation is the process of
hiding the internal data of an
object and only exposing methods
for accessing and modifying it. This
helps to protect the data from
being accidentally modified or
accessed by unauthorized code..
Object-oriented programming

Polymorphism
Polymorphism is the ability of an
object to take on different forms.
This can be achieved through
inheritance and method overriding.
JavaScript Import and Export
Introduction
Importing and exporting are essential features of modular JavaScript, allowing you to organize your code into separate files and share
functionality between them. This improves code organization, readability, and maintainability.
Import
The import statement is used to import modules into your code. It takes two forms:

Static import: This imports the named export something from the specified module.

Dynamic import: This imports the entire module asynchronously and stores it in the module variable.
JavaScript Import and Export
Export

The export statement is used to export values from your code. It also takes two forms:

Default export: This exports the entire function as the default export of the module.

Named exports: This exports the myFunction function and the myVariable variable as named exports.
JavaScript Import and Export
Import and Export Syntax Variations:
Importing everything: This imports all exports from the module as properties of the module object.

Importing specific named exports with aliases: This imports the named export something and gives it the alias.

Exporting multiple named exports: This exports multiple named exports in a single statement.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy