question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect Challenge Test Case result on Chrome

See original GitHub issue

Challenge Name

FEDC -> Basic Javascript -> Nest one Array within Another Array https://www.freecodecamp.com/challenges/nest-one-array-within-another-array

Issue Description

var myArray = [myArray]; is treated as a correct solution. Sometimes it isn’t immediately treated as correct, but upon running tests a second time it is. I haven’t ever had to run tests more than twice to have this treated as correct.

Browser Information

  • Browser Name, Google Chrome - Version 54.0.2840.59 (64-bit)
  • Operating System: Linux Mint 17.3 Xfce 64-bit
  • Mobile, Desktop, or Tablet: Laptop on a desk top.

I did try this bug on a Windows machine with Firefox. It isn’t present. It is present on Chrome however. I’ve used incognito mode in all cases. Windows Chrome version: 54.0.2840.71 m (64-bit)

Your Code

Full challenge code:

// Example
var ourArray = [["the universe", 42], ["everything", 101010]];

// Only change code below this line.
var myArray = [myArray]; 

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Bounceycommented, Oct 31, 2016

You would get [undefined], because the lexer hasn’t had a chance to assign anything to myArray.

Doing the same in my console might explain it better:

let myArray = [myArray];
console.log(myArray); // Uncaught ReferenceError: myArray is not defined | this is referencing the nested myArray

If however you do:

let myArray = [];
myArray = [myArray];
console.log(myArray); // [[]]

It is not a bug with FreeCodeCamp, but a feature(?) of the language.

I hope this clears up the issue.

0reactions
zairmcommented, Oct 23, 2016

@erictleung I think you’re right, though it only takes two tries after I’ve already set myArray to something like 1 and failed the tests. I think that’s because the default line var myArray = []; actually already sets myArray to [] before the user has a chance to play with the code.

I used

// Example
var ourArray = [["the universe", 42], ["everything", 101010]];

// Only change code below this line.
var myArray = [myArray];
console.log(myArray);

to arbitrary nest myArray in the method you suggested. I did notice that each run logged myArray twice, but with 2 different values! The first was the arbitrarily nested array, while the second was always [undefined] (the keyword undefined). Firefox always returns [undefined] twice.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incorrect Challenge Test Case result on Chrome · Issue #11331
After getting the solution correct, running tests, closing the "You Got It" popup by not continuing to the next challenge, modifying the ...
Read more >
reCAPTCHA Help - Google Support
A “CAPTCHA” is a turing test to tell human and bots apart. ... If your answer is incorrect, you will be presented with...
Read more >
Frequently asked Questions - Google Online Challenge
This online challenge with a duration of 30 to 60 minutes will include questions that tests the following: · Invalid Passkey: You have...
Read more >
Top 7 Challenges Of Cross Browser Testing With Solutions
In this blog, we will explore some common challenges of cross browser testing. Read now to see the top 7 challenges of cross...
Read more >
FIX Recaptcha Not Working in Google Chrome [Tutorial]
In this case, the solution is to update Google Chrome to the latest ... that will create this problem with reCaptcha V2 verification....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found