0% found this document useful (0 votes)
20 views

CSE326 Lec11 Part4

The document discusses JavaScript objects including object literals, using the Object constructor, Object.create(), constructor functions, classes, factory functions, and Object.assign(). JavaScript objects are like real-life objects with properties that define their characteristics. The document provides examples and references for further reading.
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)
20 views

CSE326 Lec11 Part4

The document discusses JavaScript objects including object literals, using the Object constructor, Object.create(), constructor functions, classes, factory functions, and Object.assign(). JavaScript objects are like real-life objects with properties that define their characteristics. The document provides examples and references for further reading.
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

1

Dr. Navneet Kaur, Lovely Profession


al University

CSE326
Internet Programming Laboratory
Lecture #11 Part 4
Dr. Navneet Kaur
2
Dr. Navneet Kaur, Lovely
Professional University

Outline
 JavaScript Objects
3
Dr. Navneet Kaur, Lovely
Professional University

JavaScript Objects
 Objects in JavaScript, just as in many other programming
languages, can be compared to objects in real life.
 In JavaScript, an object is a standalone entity, with properties
and type.
 For example. A cup is an object, with properties. A cup has a
color, a design, weight, a material it is made of, etc. The
same way, JavaScript objects can have properties, which
define their characteristics.
4
Dr. Navneet Kaur, Lovely
Professional University

JavaScript Objects
 Object literal - An object literal is a list of zero or more pairs
of property names and associated values of an object,
enclosed in curly braces ({}).
 Object constructor - Objects can be created using the
Object() constructor.
 Object.create() - The Object.create() method creates a new
object, using an existing object as the prototype of the newly
created object.
 Constructor function - The Function() constructor creates
Function objects. Calling the constructor directly can create
functions dynamically
5
Dr. Navneet Kaur, Lovely
Professional University

JavaScript Objects
 Class - Classes are a template for creating objects. They
encapsulate data with code to work on that data.
 Factory Functions - You can create objects using factory
functions, which are functions that return objects
 Object.assign() - The Object.assign() method is used to
copy the values and properties from one or more source
objects to a target object.
6
Dr. Navneet Kaur, Lovely
Professional University

References
 https://www.w3schools.com/js/js_objects.asp
7
Dr. Navneet Kaur, Lovely
Professional University

Program link
https://onecompiler.com/javascript/3zt9h7hsq
8
Dr. Navneet Kaur, Lovely Profession
al University

Thank you

You might also like