If it was done on purpose, wouldn’t you think a little disclaimer at the beginning of the modules lesson would be logical? Like if we were told to use old-school function declarations in the prompt we would at least have some idea what was expected of us.
I agree with you. I’m tending to believe that rather than an intentional attempt to keep us on our toes, or familiarize us with the different ways functions can be written, it’s more likely an oversight that hasn’t been corrected. I believe that it has already been brought to the attention of the Codecademy Engineering team, but I’ll double check, and report it myself if it hasn’t. It is a bit confusing.
That would be lovely. I’ve tried reporting it myself but it seems like it hasn’t done much. It’s strange because sometimes I get away with arrow functions and it isn’t an issue, like in Modules #9 “Export Named Exports”, but other times, particularly with the .forEach() method, I fail the step and have to use “function” instead (Modules 8 & 10 come to mind).
What is up with these exercises? Every convention taught in previous exercises (arrow syntax, interpolation) is suddenly not accepted anymore? I’ve just spend 5 minutes pondering over an exercise because I forgot a semi-colon.
If this is what Codecademy has to offer for €35/month then yeah, this is gonna be my final month on this platform.
Guess you get what you pay for
Is anybody else getting an error due to all the exports we did in the previous lesson on airplane.js?
SyntaxError: /home/ccuser/workspace/intermediate-javascript_modules-airplanes/airplane.js: ‘import’ and ‘export’ may only appear at the top level (31:2)
29 |
30 | export function meetsSpeedRangeRequirements(maxSpeed, minSpeed,requiredSpeedRange) {
31 | export let range=maxSpeed-minSpeed;
I’ve been reading the forums for javascript module and I also threw a bug report to report that these lessons don’t support use of a lot of ES6 functionality and interpolation. There are no replies and I’m actually shocked because I started learning ES6 and testing ways for it to work because of the first few lessons teaching ES6. It should state in the instructions if the lesson does not support ES6 functionality instead of having the user doing test cases to figure out that the lesson only supports ES5
Hi alex I’m currently working through the Intermediate Javascripts Modules and have hit the infamous arrow function blocks. looked through the comments and found yours dated August 6. Just to say that the lessons still haven’t been amended to accept arrow functions or at the very least warn the students that they can’t use them.
If you need me to send any more information just say so.
Yours, Damian
Great thanks, will chase this up again.
@factoradic and @zystvan
over one year now and this is still broken. What gives?
This is by far the most ridiculous and unnecessarily convoluted lesson on here. VERY disappointed in the quality here, code academy.
You could have gotten your point across in a short walk, but turned it in to a sprint of pointless syntax. On top of that you’ve changed up the regular flow that you have presented in past workspaces with no warning or reason. I’m in awe at the heap of mess that qualified as a lesson here.
In missionControl.js, the forEach inside the functions take two parameters, function and element. If I’m not mistaken the element argument is there to iterate over the array’s key value pairs to get .name for example.
But I am confused about the use of the function argument, what is it for? Example of the code I am talking about:
function displayFuelCapacity() {
availableAirplanes.forEach(function(element) {
console.log('Fuel Capacity of ’ + element.name + ': ’ + element.fuelCapacity);
});
}
Those are not two arguments. The entire function is the argument to Array.forEach()
.
Remember in the unit on HOFs we learned about functions that take other functions as their argument. This is known as the callback.
Array.forEach(callback)
The method is iterating over the array, and giving each value as the argument of the callback which function then operates on that value.
Aside
Arrays do not have key-value pairs, but values. We access values using their index. However, on a technical note, arrays are objects, but we don’t treat them that way. As an object, the keys would be the indices.
For our purposes we treat arrays as Array objects and use the methods inherited from its prototype, such as .forEach()
.
Array.forEach()
is a special implementation of for (let x of object)
to extract the values within the array. Just like for…of iterates the entire array, so too does forEach. The difference is that we can break
a for loop, but cannot break forEach iteration.
I’ve been wrecking my brain trying to figure out what I am doing wrong, only to find out here on the forum that it is not me but the Codecademy platform.
I see the issue regarding the arrow functions has been raised over a year ago but it appears still not to have been fixed…
I found that only at the end of each exercise are you able to change the ‘function(element){}’ to ‘(element) =>{}’
Would be nice if you could finally have this fixed!
ugh! one step I get away with an arrow function, then in the next section my code stops working and I have to go back to re-write it. This isn’t conducive to learning!!! PLEASE FIX IT!
To find that nearly 2 years has passed and the myriad issues with this lesson aren’t resolved is horribly disappointing. Unless a format is specified in an exercise, functional code should be functional code.
Given the sheer volume of free, high-quality out there, I would expect expert support be the 1st thing offered in return for paying subscribers. While I am EXTREMELY grateful to Codecademy for gifting me a 3 month PRO sub, I can’t see myself continuing my subscription if only for this reason.
Have run into the same issues (single space + arrow functions) over a year later, still not fixed! Very poor from Codecademy, huge waste of time.
Hmm nasty bug! Wrote like all the other people in here correct and working code but it didn’t got accepted. Can somebody explain what the “single space issue” meant?
Thanks!