0
Plz tell me what's wrong in this js project
Bob was hired as an airport information officer and need .. . . 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.flightNumber = flightNumber; this.status = status; };
4 Antworten
+ 1
Yes, thank you sir
+ 2
Defined flightNumber. (Not Number)
Use flight1.flightNumber; instead of flight1.Number;
console.log('The flight ' + flight1.flightNumber + ' is ' + flight1.status );
+ 1
function main() {
//here taking input of flight number and status
var flightNumber = readLine();
var flightStatus = readLine();
// here you are creating Object of Flight function into flight1 variable
var flight1= new Flight(flightNumber, flightStatus);
//output flight1 object properties in asked format
console.log('The flight ' + flight1.flightNumber + ' is ' + flight1.status);
}
// defining function with properties "flightNumber", "status" and assigning passed values into those.
function Flight(flightNumber, status) {
this.flightNumber = flightNumber;
this.status = status;
};
//is it clears?
0
Sir Plz explain me this whole code