Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

create an object using constructor javascript

 function Hotel(name, rooms, booked) {
   this.name = name;
   this.rooms = rooms;
   this.booked = booked;
}

 var quayHotel = new Hotel('Quay', 40, 29);
 var parkHotel = new Hotel('Park', 28, 11);
 
PREVIOUS NEXT
Tagged: #create #object #constructor #javascript
ADD COMMENT
Topic
Name
6+6 =