JavaScript Reference Type

Developer
Size
1,984 Kb
Views
50,600

How do I make an javascript reference type?

Practicing with JavaScript Reference Type, in this pen I've created a basic Cinema Object in which user can book his tickets for movie in his fav. Cinema.. What is a javascript reference type? How do you make a javascript reference type? This script and codes were developed by Satnam Singh on 07 October 2022, Friday.

JavaScript Reference Type Previews

JavaScript Reference Type - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>JavaScript Reference Type</title>
</head>
<body> <script src="js/index.js"></script>
</body>
</html>

JavaScript Reference Type - Script Codes JS Codes

// CustomerBooking Type
function CustomerBooking(bookingId, customerName, film, showDate) { this.bookingId = bookingId; this.customerName = customerName; this.film = film; this.showDate = showDate;
}
CustomerBooking.prototype.getBookingId = function() { return this.bookingId;
}
CustomerBooking.prototype.setBookingId = function(bookingId) { this.bookingId = bookingId;
}
CustomerBooking.prototype.getCustomerName = function() { return this.customerName;
}
CustomerBooking.prototype.setCustomerName = function(customerName) { this.customerName = customerName;
}
CustomerBooking.prototype.getFilm = function() { return this.film;
}
CustomerBooking.prototype.setFilm = function(film) { this.film = film;
}
CustomerBooking.prototype.getShowDate = function() { return this.showDate;
}
CustomerBooking.prototype.setShowDate = function(showDate) { this.showDate = showDate;
}
// Cinema Type
function Cinema() {	this.bookings = new Array();
}
Cinema.prototype.addBooking = function(bookingId, customerName, film, showDate) { this.bookings[bookingId] = new CustomerBooking(bookingId, customerName, film, showDate);
}
Cinema.prototype.getBookingsTable = function() { var booking; var bookingsTableHTML = "<table border='1'>"; for(booking in this.bookings) { bookingsTableHTML += "<tr>"; bookingsTableHTML += "<td>"; bookingsTableHTML += this.bookings[booking].getBookingId(); bookingsTableHTML += "</td>"; bookingsTableHTML += "<td>"; bookingsTableHTML += this.bookings[booking].getCustomerName(); bookingsTableHTML += "</td>"; bookingsTableHTML += "<td>"; bookingsTableHTML += this.bookings[booking].getFilm(); bookingsTableHTML += "</td>"; bookingsTableHTML += "<td>"; bookingsTableHTML += this.bookings[booking].getShowDate(); bookingsTableHTML += "</td>"; bookingsTableHTML += "</tr>"; } bookingsTableHTML += "</table>"; return bookingsTableHTML;
}
var londonNeon = new Cinema();
londonNeon.addBooking(1206, "Charles", "Avengers", "13 May 2015");
londonNeon.addBooking(115, "Williams", "Spider Man", "16 May 2015");
londonNeon.addBooking(1555, "Mariam", "Iron Man", "25 Aril 2015");
londonNeon.addBooking(1212, "Rhoda", "Super Man", "29 August 2015");
londonNeon.addBooking(150, "Jack", "King", "9 May 2015");
londonNeon.addBooking(19999, "Jones", "Avengers", "1 April 2015");
document.write(londonNeon.getBookingsTable());
JavaScript Reference Type - Script Codes
JavaScript Reference Type - Script Codes
Home Page Home
Developer Satnam Singh
Username rssatnam
Uploaded October 07, 2022
Rating 3
Size 1,984 Kb
Views 50,600
Do you need developer help for JavaScript Reference Type?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Satnam Singh (rssatnam) Script Codes
Create amazing sales emails with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!