Friday, May 9, 2014

Previous Interview Question Next Interview Question
Home

What is an Object in Javascript

In JavaScript, objects are data (variables), with properties and methods.

Almost "everything" in JavaScript can be objects. Strings, Dates, Arrays, Functions....

You can also create your own objects.

This example creates an object called "person", and adds four properties to it:


var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};


There are many different ways to create new JavaScript objects.

You can also add new properties and methods to already existing objects.

Previous Interview Question Next Interview Question
Home

0 comments :

Post a Comment