0

Code will not output message.

function flight() { //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, flightStatus) { //fix the constructor flight1.number = flightNumber; flight1.status = flightStatus; };

14th Dec 2020, 4:53 AM
Emmanuel Riano
Emmanuel Riano - avatar
2 Answers
0
Javascript or Node? Javascript doesn't use readLine(), Node does. You have 2 functions named `flight`, I think the first one was meant as function `main` The second `flight` function is a constructor, it doesn't recognize `flight1`, so you need to replace all `flight1` inside `flight` function by `this`
14th Dec 2020, 5:43 AM
Ipang
0
Yeah it works now appreciate it.
14th Dec 2020, 6:05 AM
Emmanuel Riano
Emmanuel Riano - avatar