0

Can anyone plz explain me this code ?

function main() { //take flight number and its status var flightNumber = readLine(); var flightStatus = readLine(); var flight1=new Flight(flightNumber , flightStatus ); //assign a flight object to flight1 variable //output console.log('The flight ' + flight1.number + ' is ' + flight1.status) } function Flight(flightNumber, status) { //fix the constructor this.number = flightNumber; this.status = status; };

11th Jul 2022, 1:16 PM
Pranav
Pranav - avatar
3 Respuestas
+ 4
Java and Javascript are different languages, please tag ONLY the one that is relevant to your question. The code creates a new flight object with the input data and output the object properties to console.
11th Jul 2022, 1:19 PM
Lisa
Lisa - avatar
+ 1
to run, add this at the end of code function readLine(message, defaultValue) { return prompt( message, defaultValue) } main()
12th Jul 2022, 8:20 AM
zemiak
0
Lisa thx 🛐
11th Jul 2022, 3:34 PM
Pranav
Pranav - avatar