home

Javascript Object

In javascript everything is an object, and object contains with properties and methods.

Here I am taking car for example to give clear picture on object.
Car is an object, car should have properties like color, model, name, and weight, also methods (like starts, drive, stop, break) assets of object.

All cars might have same properties, but some time times different then car to car, and all car might be have same methods but some values are different than the other cars methods.

Javascript Object with properties

Javascript properties contains with pairs values, to check that’s please see the below example code.

var Cars = {
    Carname:"BMW", 
    Model Name:"BMW64x", 
    Price:10 cr, 
    Color:"blue"
    };

Javascript Object with methods

Methods are actions for the objects and it perform based on object.

var person = {
    firstName: " michael",
    lastName : " clarke ",
    age       : 28,
    fullName : function() {
       return this.firstName + " " + this.lastName;
    }
};

Javascript Booleans represent only two values, the values true or false without quotes.

Javascript Booleans function

Here we have example of Boolean function, value of 8 greater then 7, so answer will be true. The reason is 8 bigger than the 7.

Boolean (8 > 7) value will be true