Identical code to what is used in video

Tell us what’s happening:
So basically this happens all the time. I write the proper code and it refuses to accept it. I then copy and paste the code from the video to see what I did wrong and guess what? Nothing is wrong with my code. So what gives? I even left the copied code to show that my code is not different in any way. I am actually getting extremely frustrated with this because it happens all the time on here.

Here is the kicker! I can remove the copied code from the video and it will not pass my code. I remove my code and put in the pasted code from the video and it passes it. Starting to think this is a load of crud. Time to start looking elsewhere for my javascript lessons because you cant learn on a flawed system.

Your code so far

// Setup
var myArray = [["John", 23], ["dog", 3]];

// Only change code below this line

myArray.unshift(["Paul", 35]);
myArray.unshift(["Paul", 35]);

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.88 Safari/537.36.

Challenge: Manipulate Arrays With unshift()

Link to the challenge:

1 Like

Sorry about that @mhorticultural, I followed your link and mine worked.
FFC is one of, if not the best.
I suggest you try refreshing your page, clearing cache, AND avoid copy/paste of code :smiley:

Lastly, as a beginner, I have learnt patience, perseverance and honour is key to going far in Tech not just ability to code… The best!

1 Like

Hey Patrick,

nice to meet you! :wave:

Yes, sometimes it can be quite frustrating to see stuff break.

To add to your question: If there is a platform and literally million of people can pass a test, but I can’t on my machine, then I would first try to check if my machine is the problem, especially if “this happens all the time”. E.g. trying a different web browser, clearing the cache etc.

1 Like

Hi, I’m not sure if this was a mistake in your posting or not but the code you posted is not correct. You should only have the line

myArray.unshift(["Paul", 35]);

once, rather than twice.

Your code produces an array:

[ [ 'Paul', 35 ], [ 'Paul', 35 ], [ 'dog', 3 ] ]

rather than the desired result of:

[ [ 'Paul', 35 ], [ 'dog', 3 ] ]

The code is showing twice for example. My code being the first, and the second being from the video to show that my is identical and should not fail. I know better than to run the code like that for testing. I have cleared my cache, tried several other browsers and the usual recommendations to which all failed.

I did try what you recommended and still came up with the same issue. I just dont get how it can constantly do this.

I think you are misunderstanding what the copy and paste of code was used for. I used the copied and pasted code as example to show my code was identical to the tutorial video code. I did this as my last resort to verify my code was correct, yet still not passing.

what do you get in the console when you run the tests?

:smiley: I get you, typing is stressful too, so I still copy texts, what I meant was copying can include characters whose scope, the “test” doesn’t cover… just a tip

@mhorticultural did it eventually run when you tried again?

If no, check the user story to see the error message.