what is problem here JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is problem here JavaScript

function main() { //take flight number and its status var flightNumber = readLine(); var flightStatus = readLine(); var flight1 = new Flight("SBI 3205", "delayed"); var flight2 = new Flight("NGT 786", "ontime"); var flight3 = new Flight("NMF 179", "canceled"); //assign a flight object to flight1 variable //output console.log('The flight ' + flight1.number + ' is ' + flight1.status); console.log('The flight ' + flight2.number + ' is ' + flight2.status); console.log('The flight ' + flight3.number + ' is ' + flight3.status); } function Flight(flightNumber, status) { //fix the constructor this.number = flightNumber; this.status = status; }; test case 1 is getting passed after removing this two lines console.log('The flight ' + flight2.number + ' is ' + flight2.status); console.log('The flight ' + flight3.number + ' is ' + flight3.status); but when i add this two lines all test fails output: The flight SBI 3205 is delayed The flight NGT 786 is ontime The flight NMF 179 is canceled

4th Feb 2023, 7:06 AM
Alert(jerry);
Alert(jerry); - avatar
2 Answers
+ 1
Alert(1); change some line and now its correct, Just look this.. function main() { var flightNumber = readLine(); var flightStatus = readLine(); var flight1 = new Flight(flightNumber,flightStatus); console.log('The flight ' + flight1.number + ' is ' + flight1.status); } function Flight(flightNumber, status) { this.number = flightNumber; this.status = status; };
4th Feb 2023, 7:36 AM
Darpan kesharwani🇮🇳[Inactive📚]
Darpan kesharwani🇮🇳[Inactive📚] - avatar
0
can u share the link of the question or code challenge?
4th Feb 2023, 7:37 AM
Arturop
Arturop - avatar