Hi everyone, I’m just wondering if anyone knows why this code doesn,t pass the test even though I get the correct output every time. I already fixed it by replacing this arr1.slice(i, i+1) with this arr1[i] inside the for loop but I just don’t understand why that fixes the issue if still I get the same output.
ohh next time i will run and check my code in local editor( VS Code). The FCC browser console display format is the issue . I was chopping and changing my code but result was showing similar and was not able to debug properly and i was stuck here for last 1 hr.
Thanks.
The results window in fCC passes the result through the toString() method. In many cases, that is necessary but when you use toString() on an array, you don’t see the braces.
See below:
You can use your browser’s console or another editor to see results without the toString().