How To Make JS Your Own - Optimizing Our Code 5/10


#1

I'm not sure what I'm supposed to do here. This is the only exercise that I have left in this section. The code in the screenshot is the code that's provided with the exercise.


#2

Hi @opticondude,

Does the exercise pass you if you click Save & Submit Code?

If not, please post a link to the exercise.


#3

It doesn't.

https://www.codecademy.com/en/courses/javascript-intermediate-en-2nQQb/0/5


#4

I'm not really sure what that exercise wants. It's not an official track, so it's more likely to be broken or have issues with clarity in the instructions than other courses. (Learn JavaScript is the official JS course)

@ionatan is a better programmer than me, so I'll let him see if perhaps he can figure this out.


#5

Yikes, I dunno about that.

But I had a look - I tried the exercise with the code in the screenshot (which I got to type in manually, note that usually we represent code using unicode (text), not .. png)

This exercise has no default code, it just brings over the code from the previous exercise. Clicking the reset button should take the code from exercise 4.

The instructions of this exercise and the ones that come before explain what to do - that answers the question here (at least until something more specific is asked)

What I'd do is to consider whether exercise 4 has been correctly completed
if yes, copy that code to exercise 5 (or click exercise 5's reset button)
if no, start over from exercise 1 since exercise 5 builds on exercises 1 through 4


#6

I've already completed the original track listing on the site; in fact, after completing, I am unable to do any of the original programming exercises.

@ionatan I have every exercise on this track completed, meaning that the code I used for exercise 4 passed.


#7

Perhaps its asking to change line 4 to...

    if((x==52 || x==88) && y==33)

This will result in fewer comparisons, and potentially not even checking y==33 due to 'short-circuit-evaluation'


#8

There are a couple of items in the instructions that I don't see in your code:

  • ... let's always start y at x

  • Define an array named permutations ...


#9

The code in your screenshot doesn't satisfy exercises 1 through 4, so you'll need to obtain a correct solution for 1 through 4 either by doing those exercises or if you've already done so correctly by copying the code from 4. Having passed them is also no guarantee for having completed them, that is something you need to judge by considering whether you've done each thing described