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

CSE326 Lec11 Part41

The document discusses JavaScript objects. It defines objects as entities with properties that define their characteristics, similar to real-life objects. It describes several ways to create JavaScript objects, including object literals, the Object constructor, Object.create(), constructor functions, classes, and factory functions. The document also mentions Object.assign() for copying properties between objects and provides references and a program link for further information.
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)
39 views8 pages

CSE326 Lec11 Part41

The document discusses JavaScript objects. It defines objects as entities with properties that define their characteristics, similar to real-life objects. It describes several ways to create JavaScript objects, including object literals, the Object constructor, Object.create(), constructor functions, classes, and factory functions. The document also mentions Object.assign() for copying properties between objects and provides references and a program link for further information.
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/ 8

1

Dr. Navneet Kaur, Lovely


Professional 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
Professional University

Thank you

You might also like