0% found this document useful (0 votes)
21 views2 pages

JavaScript Objects: Properties & Methods

This document introduces JavaScript objects. It explains that JavaScript is an object-oriented programming language that allows you to define your own objects and variable types. It notes that an object has properties and methods - properties are the values associated with an object, while methods are the actions that can be performed on objects. Examples are given showing the use of the length property and toUpperCase() method of the built-in String object.

Uploaded by

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

JavaScript Objects: Properties & Methods

This document introduces JavaScript objects. It explains that JavaScript is an object-oriented programming language that allows you to define your own objects and variable types. It notes that an object has properties and methods - properties are the values associated with an object, while methods are the actions that can be performed on objects. Examples are given showing the use of the length property and toUpperCase() method of the built-in String object.

Uploaded by

BaneeIshaqueK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

JavaScript Objects Introduction

JavaScript is an Object Oriented Programming (OOP) language.


An OOP language allows you to define your own objects and mae your own variable
types.
Object Oriented Programming
JavaScript is an Object Oriented Programming (OOP) language. An OOP language allows you to
define your own objects and mae your own variable types.
!owever" creating your own objects will be e#plained later" in t$e Advanced JavaScript section. %e
will start by looing at t$e built&in JavaScript objects" and $ow t$ey are used. '$e ne#t pages will
e#plain eac$ built&in JavaScript object in detail.
(ote t$at an object is just a special ind of data. An object $as properties and met$ods.
Properties
Properties are t$e values associated wit$ an object.
In t$e following e#ample we are using t$e lengt$ property of t$e String object to return t$e number
of c$aracters in a string)
<script type="text/javascript">
var txt="Hello World!";
document.write(txt.lent!";
</script>
'$e output of t$e code above will be)
#$
*et$ods
*et$ods are t$e actions t$at can be performed on objects.
In t$e following e#ample we are using t$e to+pper,ase() met$od of t$e String object to display a
te#t in uppercase letters)
<script type="text/javascript">
var str="Hello world!";
document.write(str.to%pper&ase("";
</script>
'$e output of t$e code above will be)
H'(() W)*(+!

You might also like