My code passes the test, but I came across a strange problem while running the code on jsbin.com. the code is here if you want to look at it: SPOILER ALERT jsbin
I used a for loop to push values to an array. When I printed the array to console it would return this:
[[“G”, “C”], [“C”, “G”], [circular object Array]]
it would not print the 3rd element in the array. I tried various things, like switching from push() to assigning values with the = operator. But nothing worked. No errors either.
It turns out that the code works just fine when I paste it into the codeCamp challenge, but it does not work in JSbin. The only change I make is that I use return arr instead of printing it to the console.
Googling the issue seemed to point to problems in the developer console and not in the code. I couldn’d find anything mentioning this here in the algorithm section. I felt that it should be out there somewhere. I ran around in circles for awhile on this only to find out that my first code would have worked.
browser used: Chromium
Hope this helps someone.