Mixed Messages- Crossfit

Thanks for coming to share your portfolio Project with other learners!

When posting your project for review, please be sure to include the following:

  • Your review of the Project. Was it easy, difficult, just right?
  • An estimate of how long it took you to complete
  • The link to your code repo

We hope you enjoyed this project!

1 Like

Hiya :wave:

Unfortunately it doesn’t seem like I’m able to run the file from the repo as randomSelect() isn’t defined in the shared file, is there another file that has that defined that’s not in the repo perhaps?

Hiii

Thank you for having a look for me and replying back :). To be honest I dont get how to get it to run?! will it let you click on scripts (script.js)?

Many thanks,
Anna

Hi!

I downloaded the file and ran it locally but on line 17:

// Group Project: Mixed Messages by Anna Maddocks const suspectedElements = { athletes: ['Matt Fraser', 'Rich Froning', 'Katrin DavisDottir', 'Tia Toomey', 'Brooke Wells', 'Patrick Vellner'], event: ['Event1', 'Event2', 'Event3', 'Event4', 'Event5', 'Event6'], exercise: ['Deadlift', 'Squat Clean', 'Handstand Walking', 'Snatch', 'Box Jumps', 'Double Unders', 'OverHead Squat', 'Handstand Pushups'] }; let accusation = []; let randomeSelect = arrayLength => { return Math.floor(Math.random() * arrayLength); } for (let element in suspectedElements) { let randomIndex = randomSelect(suspectedElements[element].length); switch (element) { case 'athletes': accusation.push(`Competitor ${suspectedElements[element][randomIndex]},`); break; case 'event': accusation.push(`in ${suspectedElements[element][randomIndex]},`); break; case 'exercise': accusation.push(`hit an amazing new PB in their ${suspectedElements[element][randomIndex]}.`); break; } } console.log(accusation.join(' '));

It uses randomSelect() which isn’t defined anywhere in the file, is there perhaps another file that would have ran alongside it in the Codecademy workspace?

-Lyall

Hi! Apologies for butting in, I was having a little peek at your code as I’ve created something very similar. I don’t know if you’ve fixed your problem yet but the issue seems to be that you’ve declared the variable as randomeSelect() on line 17, but then called it as randomSelect() on line 23. This seems to fix the problem on the Codebyte posted by lyallstewart and the program runs :slightly_smiling_face:

1 Like