August 19, 2009

Javascript Tutorial 13: Objects

Objects have two main parts: properties and methods. Property is any value of the object for example it's length and method changes the element to something else.


var test="this is just a test";
document.write(word.length);


This will show how many characters the variable "test" is. This a property of javascript where length is what it is called. Now let's use method:


var test="this is just a test";
document.write(word.toUpperCase());

This will change the text string to upper case.



Powered by ScribeFire.

No comments:

Post a Comment