WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1Accespted Javascript Obejcts on Thu Apr 12, 2012 5:00 pm

Mr.Joker

avatar
Mr. WebArtz
Mr. WebArtz
Javascript Obejcts
Working with JavaScript Objects


Hello again and again, I am Mr.Joker , and today I will try to teach you what is object in javascript. Well, an object have his own property and method. You allready saw an object while you did some javascripts in past as :

Code:
document.write("Something");

Wait a second. How this can be a object? Well, a document is an object. Why a document is an object? Its because that object have own methods. And one of the methods is write. The object document add a method write and boom, something happend on the screen. But If you want more understandable example of object in real life , ok here we go. Lets imagine I am an object (dont laugh). So I am an object in real life called Aleksandar Arsic. And I have my own properties. What is propertie? Well, a propertie for real life would be my favorite football team, my favorite color, my school, my age, my nickname, and all bunch of things. So , now that you finaly understand what an objectis is lets give a real example.

Code:
<script type="text/javascript">
var text = "Some random text.";
document.write(text.length);
</script>

When we run this code there will be number 17 witch is normal because we asked from javascript to calculate how much characters there are inside variable text and print it out on the screen. When I use a variable and add a dot + name of properite then that variable become an object. If its hard to understand trust me its not that much twisted. In next tutorial I will talk about creating your own objects which is totaly cool.

Notice : These tutorials are copyrighted by WebArtz Forum. You may not publish it on anywhere without written permission from the administrators.

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum