Whoever is reading this in 2020, this was already fixed and there is no “extra first line” in this exercise.
Is this exercise bugged or something? It would not accept my solution yet it was the same exact solution shown when I hit “View Solution”.
- Confused
I’m having the same issue. The typesetter/highlighter/color-coding doesn’t seem to recognize myAirplane:
as a key and neither does whatever checker is used to test for correct solutions.
Same here. It’s not accepting the myAirplane: "CloudJet"
key-value pair despite both the hint and the solution showing exactly that
When I express the anonymous function that is the value to displayAirplane in arrow syntax, it stops working. I think others have had this problem as well. Why does this happen?
In this lesson, step 4 when I write file path in double quote inside require() function,it doesn’t work.I don’t know why?
But when I write in single quote it works.
I struggled with this aswell and sent a bug report to CodeCademy.
The only solution i found was to click the “get solution” button.
That let me move on to the next step.
In step-1: module.exports = {};
not accepting.
I tried:
let (and/or const) Airplane ={};
module.exports = {};
Still not accepting! It logs a message: Did you set ‘module.exports’ equal to an empty object? (But it doesn’t throw system error.)
Yes, I did
Am I doing something wrong? or is it a bug?
im also getting an error here
module.exports = {};
not sure why this isnt working
I was able to get through step 1 by copying/pasting the code from the hint in step 1 (even though it was the same as the code that I input and and not worked). In step 2 the myAirplane key is not being detected unless I have const Airplane = {} above the module.exports. This is a bit weird
Same here. You’d think it being a paid tutorial with so many people asking about it someone from Codecademy would have corrected it by now. Kinda obnoxious.
Edit: Adding a comma at the end of “CloudJet” fixed it for me without adding the const Airplane = {}. I’m assuming because the program is expecting another key to follow which makes the error make more sense.
module.exports = {
myAirplane: “CloudJet”,
};
const Airplane = require("./2-airplane.js");
Why is it not working?
I had the same issue. The test rejects double quotation marks around the filename. I’m not sure whether this is intentional.
Yes, I agree - the format in the ‘Cheetsheet’ uses double quotes, but that doesn’t work. I also had another issue where I had left off (what I thought was) an ‘optional’ semi-colon at the end of a line that stopped the script from completing. As a learner, it is very confusing - I don’t know what is right and what is wrong.
How is the property and method added to menu when in this example the variable menu was never declared until until the end.
module.exports = { specialty: “Roasted Beet Burger with Mint Sauce”, getSpecialty: function() { return this.specialty; } };
In the above code, notice:
-
module.exports
exposes the current module as an object. -
specialty
andgetSpecialty
are properties on the object.
Then in order.js , we write:
const Menu = require(’./menu.js’); console.log(Menu.getSpecialty());
With step 3 I have tried everything to get it to work then after seeing in its hint that “CloudJet” has a comma at the end which is not present in step 2 hint. Step 2 can be passed without using a comma or a semi colon at the end but will not let you pass step 3 even if you get it all of step 3 correct.
This is because you don’t need to separate any properties.
In step 2 there is only one property in the object, so you don’t need a comma - when adding a second (or more) properties they need to be separated by a comma.
Wondering the same thing…
Some of these more advanced lessons are seeming to lack detail and it’s becoming a bit frustrating. Personally, I think small video clips to supplement the teaching would be helpful.
Regardless, if someone could assist… I am confused as to how the code block below:
module.exports = {
myAirplane: “CloudJet”,
displayAirplane: function() {
return this.myAirplane;
}
};
Can be used within the next step/code:
const Airplane = require(’./2-airplane.js’)
console.log(Airplane.displayAirplane())
The displayAirplane method has no variable associated with the object., so how is it that Airplane.displayAirplane() works?
I hope this makes sense.
On lesson 4 under Modules (module.exports II), an object literal is assigned to module.exports.
module.exports = {
myAirplane: “CloudJet”,
displayAirplane: function(){
return this.myAirplane;
}
};
In the 2-missionControl.js, how can I call the displayAirplane function against Airplane?
console.log(Airplane.displayAirplane())
Where in the 2-airplane.js did we define this function against Airplane variable?
Can somebody please help?