javascript objects tutorial

In JavaScript Every thing is considered as an Object except Boolean Values . Creating and Objects and accessing its properties are very important tasks in Java script. Let us discuss about an object with an Examples .

Let us create an object of a "Person"

<script>
var person={}; This Indicates an empty object with a name of person.
person.firstName="Murali"; This indicates Object having a property of First Name and its value is Murali.
person.lastName="Krishna"; This indicates Object having a property of First Name and its value is Krishna.
person.company="HP";This indicates Object having a property of Company  and its value is HP.

</script>

Now Let us look how can we access the object Properties .

To access the Property of an object we have to access the object.

Console.log(person.firstName); it will give the value of the person Fist name . In same way we can access all the properties.

Comments

Popular posts from this blog

HTML Attributes ....

How to Study Web Developement Course