Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How do you create a new object in JavaScript?

Answers were Sorted based on User's Feedback



How do you create a new object in JavaScript?..

Answer / sri

The following function can be used as demonstrated to create
an object of class myobject:

function myobject() {
this.containedValue = 0;
this.othercontainedValue = 0;
this.anothercontainedValue = 0;
}

var mything = new myobject();
And there you go, mything is now an instance of class
myobject. It will have the following properties, all of
which will be 0:

* mything.containedValue
* mything.othercontainedValue
* mything.anothercontainedValue

You could also now write
myobject.prototype.newContainedValue = someValue; and all
instances of class myobject will have the property
newContainedValue with value someValue.

Is This Answer Correct ?    7 Yes 4 No

How do you create a new object in JavaScript?..

Answer / nidz

var myObject={} this also creates a new object

Is This Answer Correct ?    4 Yes 2 No

How do you create a new object in JavaScript?..

Answer / elan

var newObject;

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More JavaScript Interview Questions

How can the os of the client machine be detected?

0 Answers  


What are parameters in javascript?

0 Answers  


What is enum with example?

0 Answers  


what is service now ticketing tool how it works

0 Answers   Ideal Vision,


When selecting the states by giving the country as input using ajax cal, how can we ensure that every time it is hitting the DB and fetching the data? Many time it may load from the cache.

1 Answers   CTS, GE,


What are javascript properties?

0 Answers  


What is escape & unescape String functions in JavaScript?

0 Answers  


how can we create own web browser?

1 Answers   IBM, Infosys,


How do you include a comment in javascript?

0 Answers  


How do you convert numbers between different bases in JavaScript?

4 Answers   College School Exams Tests, Satyam, UIST, Wipro,


What are the uses of javascript in web page designing?

0 Answers  


How to make a function in javascript?

0 Answers  


Categories