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; };
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.
+ 1
to run, add this at the end of code
function readLine(message, defaultValue) {
return prompt( message, defaultValue)
}
main()
0
Lisa thx 🛐