+ 1
The Java and Javascript intermidiate courses are riddled with really bad errors. This 'solution' doesn't even run!
I just erased the code and made my own solution. Below is the official 'solution' From Landed! exercise on JS Intermidiate function main() { let flightNumber = readline(); let flightStatus = readLine(); let flight1 = new Flight(flightNumber, flightStatus); console.log("The flight" + flight1.number + " is " + flight1.status); }; function Flight(flightNumber, status) { this.number = flightNumber; this.status = flightStatus; }; This was clearly written by someone used to Java and the use of 'var' is outdated. This site has really lost its way.
2 Answers
+ 4
The Javascript code is valid. It is the same task as in the old Javascript course and introduces Javascript objects.
Modern classes are explained later in the course.
In the 2nd to last line, it would be
this.status = status;
as status refers to the parameter name in the constructor.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects?retiredLocale=de
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
+ 3
Probably good to email such feedback to info@sololearn.com