I think something went wrong

Tell us what’s happening:
Hi everyone!
For some reason this task was already done when I got to it, I didn’t do it. I just read the task, look at code, it was weird cause it seemed complete. I decided to check, hit the the Run test button, and it said that it’s done. How is it possible? Why was it done before I did it?

Your code so far


const s = [5, 7, 2];
function editInPlace() {
'use strict';
// Only change code below this line
s[0] = 2;
s[1] = 5;
s[2] = 7;
// Using s = [2, 5, 7] would be invalid

// Only change code above this line
}
editInPlace();

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36.

Challenge: Mutate an Array Declared with const

Link to the challenge:

what appear in the console when you run the tests?

One possibility I could imagine is that you once read a thread in the forums about this challenge, and pasted the provided code in order to check it.

No I didn’t. I just do all in oder. So I did the previous one, come to this one and saw that it’s already done. I don’t know why. It’s OK with me, just don’t think it should work like this.

Nothing, please read my description carefully. I explain what happened

the code is saved in browser cache, if you share the computer with someone else this can happen. or if you helped someone on the forum with this challenge

I don’t think I did. the site has similar task in Basic JScrip (about how to change data in array). And here is the same challange but about const and var thing. Could it be that these two task are connected? And this one is done cause I did the one in Basic JS? Can you check it?

Plus, all the other tasks that I have done before are empty again when I open them 2nd, 3d etc time. So it should be empty too even if I did it before (but I didn’t do it anyway)

I don’t think a different website can retrieve data from local storage

those are the only possibilites for how weird it can be, there should not be an other situation in which the challenge code is already completed

for example you have helped here:

Yes, it was other task. In Basic JS . I wrote about it above

the task that I show here is in ES6 and it’s about const and var (and I wrote about it above too)

the link for the challenge you helped in the other topic:

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const

isn’t it terribly similar to the one you are asking about here?

Yes, and that is why I’m asking and I don’t know why. Cause I only started to do ES6 yesterday evening I think but I’m sure it was after this post where I helped so I was in Basic JS when I answered that post.

I don’t know why it was complete and I have already gone to the next challenges. I just wanted to warn if there is some problem or bug. If not I’m sorry. I was just worrying.

the challenge you helped for is in the es6 section, so if you typed code in it to see how it worked to help the user, then that is the code you found reaching that challenge in your normal progression

you found code in the editor, because you had already opened that specific challenge and typed in it

Ok, but why is there? I mean, when I open challenges that I already passed (like now I went and open any Basic JS challenge) there is no code that I wrote previously in it. Yes, I passed it but the code isn’t saved there (I can do a screenshot if needed). So why this one has a code (I mean even if I passed it why it’s not working like other challenges that I passed)?

for some reason if you use the submit button in the modal, the code is deleted - there are a few issues open in the github repo for this

Ok, so why this one wasn’t deleted?

I’m just trying to understand why I had the code in this specific one

if you didn’t use the submit button, but only “Run the tests” when you were helping the other user, that’s what happened

1 Like

I might be wrong, but it seems if you are logged in and pass the test it maybe saves the “completed” state to your profile but then clears the code. Again, I haven’t actually looked at the code so it’s just speculation.

Not sure why it (if true) is done like that. I would like for it to remember the code just like when I’m not logged in.

Edit: It doesn’t seem to matter how I submit the code.

Oh! so maybe I went to help and cause it wasn’t in order for my challenges and it was a little bit ahead I decided to not submit it and that is why it was saved.
Ok! now I understand. Thank you very much!!

I was saying this, it seems to be still the case - don’t know why it was closed

2 Likes