Javascript TUTORIAL

Javascript In Built Objects

We have already seen how to create your own class and define methods in the class. Javascript has a number of inbuilt classes. It has inbuild classes for nearly every comman tasks that you can think of. You have to be just aware that they exist.

We have already seen that a calss comprises of Properties and Methods defined on the properties. The Inbuild javascript classes have on a similar Properties and methods defined upon them.

Let us take a look at the following line we have been using so frequently till now.


The document is an object. The write() is a method of the object that takes an string argument outputs it to screen. Let us take another example - this time an inbuilt string class.

<script type="text/javascript">
Example - Javascript in built string class 

var txt="Hello";
document.write("The length of Hello is "+ txt.length + "<p>");

document.write(txt.toUpperCase()+ "<p>");

The length is a property of the String Object. The toUppercase() is a method of the String object that converts String to uppercase.

You can try the example at the link below which will open in a new window

Example - Javascript String Object