Challenge 20 Megathread

Welcome to challenge #20!

Use this thread for any and all questions relating to challenge 20

If you have an issue with the starter code, make sure to copy this version:

const confirmReentryPlans = (speed, missionData, checks) => {
  // Code here!
}
5 Likes

Is it just me or does the code you start with have an error?

I erased all the code and there was an error when I tested the code.

Well off to bed!! But this challenge is a fun one!!

6 Likes

Nope this happened to me too

No matter the code I enter, I get a ‘unexpected token {’
This even happens if I erase my code and leave it only with a ‘return true’

LHL my team wants #1, but keeps on finding errors in your code when you publish it and can’t do work until it gets fixed

image

EDIT: COOLSDAY FOUND THE SOLUTION BELOW. Change the first line to be:

const confirmReentryPlans = (speed, missionData, checks) => {}

If this happens tomorrow, I’m gonna be pissed…

1 Like

yea, I’m pretty sure they are missing the “=>” key in the function declaration. So instead of

const confirmReentryPlans = (speed, missionData, checks)  { ... }

it should be,

const confirmReentryPlans = (speed, missionData, checks) => {..}
6 Likes

Did this in 3 lines :slight_smile:

It is missing the fat arrow syntax to turn the CONST into a function => {

Noticed that when I looked at the little side-bar notice indicators. It said missing expect }

And I’m here going What? No there’s open and close for every brace, What are you talking about code!?

So I looked closely and noticed that.

2 Likes

Indeed it is missing this small part, sorry about the inconvenience!

It’s been fixed in the starter code, if you tested one you can use this:

const confirmReentryPlans = (speed, missionData, checks) => {
  // Code here!
}
1 Like

Got it!
Took longer than I thought it would with that missing bit of syntax.
Also had code not working for whatever be the reason, but as I often have shown here, I also test JS in either the Mozilla site or JSFiddle, and it was working there.

So I must have made a typo, because I just copied the working code from my fiddler, and boom, all better shrug

Not a bad test.
I just assumed a bad output, and then performed tests to flip that if nothing incorrect is found.

I was thinking that it was part of the test. :laughing:

2 Likes

hey can someone help me out with the solution i fixed the issue with the arrow function but i keep getting something wrong with astro value

Any ideas, it is failing for proper value?

im having the exact same problem and i still havnt figured it out

Either change c. To checks. Or change checks in the function can to c

Same for your a and b.

You haven’t declared vars a, b, c anywhere.

1 Like


I’m 99% sure the tests are messed up somewhere. Because my first screenshot should be working yet doesn’t. And if I swap the final return to false I get a whole other failed test.

Here’s a screenshot showing that my code does indeed return false for that failed test. I’m starting to get seriously irritated at this point.

if(speed <= checks.maxSpeed || speed >= checks.minSpeed){
      for (const mission in missionData){
        if(mission.length === checks.dataEntries){
          console.log(speed);
          return true;
        }
      }
    } 
      return false;

Ok, so this is my code and I am very sure I have met all the requirements. However, It is not working. Can you please let me know if anything is wrong with this code?

Sad to hear you’re getting irritated, however that’s the enemy of debugging!

In your code, you have something wrong the logic and I’ll give you a quick hint, what is the value of the first parameter of the forEach callback ? (el in your case)

1 Like

I don’t understand your hint. The first el in the callback is astro as it should be.

You’re very close!

I’d look at the value of mission with a console.log between the start of the for loop and your if statement.

1 Like

Sorry, the goal of logging it was to show that even if it finds a false, the other values still show up.

Returning inside the forEach loop doesn’t exit the parent function, only the callback part.

1 Like