/* file: script.js */
// User Editable Region
if (keys.rightKey.pressed && isCheckpointCollisionDetectionActive) {
platforms.forEach(platform => {
platform.x -= 5;
});
}
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0
I did and didn’t work, but it’s fine because I can’t fully visualize the concepts in Javascript yet. So for me even what you just sent me looks no different than what I already have.
Did you start this course without attempting the other course prior to it?
I am asking because there is expectations in this one that you have knowledge and understanding of the language which builds upon each other.
In any case, the concept at hand is about arrow function expression:
() => {
statements
}
As argument passed to the forEach method of the object platforms.
I think if you are learning its better if you understand what he was saying was platforms.forEach(platform => {
platform.x -= 5;} over here you should use the parameter since then it would mean that for each would iterate over all the elements of platforms and platform would be the values at any index and then you would have to use the subtraction assignment on it