0

Any help and explanation for this topic("object constructor") & question will be highly appreciated. Thank you in advance!

Bob was hired as an airport information officer and needs to generate status messages for each flight․ Let’s help him! Complete the given program by fixing the constructor, making a flight object, and assign it to given variable to correctly execute the corresponding message. Flight ID and the flight status(landed, on time, delayed, etc.) are taken as input. \\my poor code function main() { //take flight number and its status var flightNumber = readLine(); var flightStatus = readLine(); } function flight(flightNumber, flightStatus) { //fix the constructor this.flightNumber = flightNumber; this.flightStatus = flightStatus; } var flight1 = new flight(flightNumber,flightStatus); console.log('The flight ' + flight1.flightNumber + ' is ' + flight1.flightStatus)

14th Jul 2021, 4:35 PM
Sanchit Bahl
Sanchit Bahl - avatar
1 Resposta
+ 2
var flight to console.log lines should be inside main function.
14th Jul 2021, 4:52 PM
Abhay
Abhay - avatar