JSFiddle - React, Tailwind, and code Playground

by Giorgio Malvone

HTML

<h3 class="hotelName">Error - Hotel Name could not be found.</h3>
<p class="roomsAvailable">Error - Room availability could not be checked.</p>

JavaScript

//in objects, variabbles are properties, and functions are methods

var nameHeader = document.getElementsByClassName("hotelName")[0];
var roomsAvailableElement = document.getElementsByClassName("roomsAvailable")[0];

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