Answers for "create an object using constructor javascript"

1

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);
Posted by: Guest on August-04-2021
8

javascript constructor object

function Person(first, last, age, eye) {
  this.firstName = first;
  this.lastName = last;
  this.age = age;
  this.eyeColor = eye;
}
Posted by: Guest on December-01-2019
9

js constructor object

function Car(make, model, year) {
  this.make = make;
  this.model = model;
  this.year = year;
}

var car1 = new Car('Eagle', 'Talon TSi', 1993);

console.log(car1.make);
// expected output: "Eagle"
Posted by: Guest on December-03-2019

Code answers related to "create an object using constructor javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language