JavaScript Reference Type
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 - 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());
Developer | Satnam Singh |
Username | rssatnam |
Uploaded | October 07, 2022 |
Rating | 3 |
Size | 1,984 Kb |
Views | 50,600 |
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!
Name | Size |
Navigation Icon 3 lines to X | 2,053 Kb |
CSS Image Parallax Effect | 2,232 Kb |
Image Viewer | 2,115 Kb |
CSS3 Form Page Design | 3,613 Kb |
Giving Strike, Del or S elements a Color | 1,505 Kb |
Menu Hover Animation | 2,057 Kb |
CSS Ribbon | 1,903 Kb |
SVG Cone Scribble | 1,724 Kb |
Pure CSS3 Drop-down Navigation with Effects | 2,262 Kb |
Name Hover Bubble Animation | 1,639 Kb |
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!
Name | Username | Size |
Donald Trump - The New Yorker | Agbales | 2,502 Kb |
Em Test | Rodesco | 1,784 Kb |
A Pen by Ben Babics | Benbabics | 2,957 Kb |
Pericles mi loro... | Judag | 4,125 Kb |
Apple website | Jds317 | 1,835 Kb |
Knob rotation | Alemesre | 2,122 Kb |
Twitch | SarahDunlap | 2,937 Kb |
Social buttons | Flacu | 2,022 Kb |
Prism | Pyrografix | 2,843 Kb |
SVG Basics | HipsterBrown | 1,852 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!