0% found this document useful (0 votes)
5 views7 pages

What Was The Need of Objects

Objects are entities that encapsulate properties and methods, allowing for the storage of multiple values as key-value pairs. Unlike variables, which can hold only a single value, objects enable better organization and handling of data in applications. This capability is essential for developers to create complex applications that reflect real-world scenarios.

Uploaded by

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

What Was The Need of Objects

Objects are entities that encapsulate properties and methods, allowing for the storage of multiple values as key-value pairs. Unlike variables, which can hold only a single value, objects enable better organization and handling of data in applications. This capability is essential for developers to create complex applications that reflect real-world scenarios.

Uploaded by

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

What was

the need of
objects
List of content
1. What are objects

2. How are objects different from variables

3. Why do we need object


What are objects
● An object is an entity (properties and method) with a certain state and
behavior. Examples include a car, pen, bicycle, chair, glass, keyboard, and
monitor.

● Objects can contain many values.

● Object values are written as key : value pairs (key and value separated by a
colon)
Example for better understanding
Car (object)

Attributes/Data Behaviour

Name, Can start,


Manufacturer, Can stop,
Fuel Capacity Can accelerate

Name: Honda City, Manufacturer: Honda, Fuel capacity: 40 l


Name: Seltos, Manufacturer: Kia, Fuel capacity: 50 l
Example for better understanding
Variables Objects
A variable is a named stored location
Object is just a name given to user-defined variables
which holds a value
A variable can be initialized in a usual
Objects are declared and initialized as per the developer’s wish
manner.
A variable can contain only one value
An object contains multiple values
at a time
Eg. let person = {firstName:"ABC", lastName:"XYZ", age:20}
Eg. let name, var age, etc.
Note: We will cover this in the forthcoming classes

Name: Honda City, Manufacturer: Honda, Fuel capacity: 40 l


Name: Seltos, Manufacturer: Kia, Fuel capacity: 50 l
Why do we need objects
● Variables limit us to handling only one value at a time whereas objects enable
us to have multiple values of multiple data types to be stored under one name.
● This not only gives the privilege of escaping many variables for our
applications but also organizes the code for better data handling.
● Objects are a boon for developers to develop applications that we see in the
current web world.
● Objects give us the liberty to see and implement the scenarios in real-world
form rather than disconnecting the actual application from the implemented
one.
THANK YOU

You might also like