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 |
SVG Cone Scribble | 1,724 Kb |
CSS Ribbon | 1,903 Kb |
Countdown Timer with Video | 2,428 Kb |
Giving Strike, Del or S elements a Color | 1,505 Kb |
Menu Hover Animation | 2,057 Kb |
Name Hover Bubble Animation | 1,639 Kb |
CSS3 Form Page Design | 3,613 Kb |
JavaScript Reference Type | 1,984 Kb |
Navigation Slider | 2,107 Kb |
Navigation Icon 3 lines to X | 2,053 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 |
Slider css only | Armandobau | 2,161 Kb |
Test | Dviate | 2,668 Kb |
Flat UI Button | Honchoman | 2,289 Kb |
BSP Dungeon Generation | Xgundam05 | 5,326 Kb |
Multi column experiment. | Spylefkaditis | 2,805 Kb |
Testimonial Fancy tabs responsive | Amit-webdesigner | 3,056 Kb |
RSW | JordanC | 3,726 Kb |
Scoreboard.js basic usage | Tbleckert | 1,733 Kb |
Michelle, submit your photography to Unsplash. | Zaneriley | 3,368 Kb |
TheCalendar.js | The-teacher | 6,330 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!