Is there a bug in this challenge

It doesn’t accept my solution saying it’s hard coded even though it is not and it works for all cases.

Problem:

nonMutatingSort(globalArray) should not be hard coded.

code:


var globalArray = [5, 6, 3, 2, 9];
function nonMutatingSort(arr) {
 // Only change code below this line
return [...arr].sort((a,b)=>{return a-b;})


 // Only change code above this line
}
nonMutatingSort(globalArray);
   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0

Challenge: Return a Sorted Array Without Changing the Original Array

Link to the challenge:

Hi @Renko

Welcome to FCC.
Your solution passes for me on chrome.

2 Likes

Thanks for the fast reply.
I just tried it on chrome now and it did work. Which is not the ideal case,
Anyway, Thank you again for your help. Have a good day!

1 Like

I think FCC runs your code in the browser, and if that is the case you will find variances on how different browsers implement ECMAScript, and in the case you are using an older browser its entirely possible they are using an outdated version of ECMAScript to base their implementation off of.

1 Like

I updated Firefox to the latest version and that solved the problem, thanks!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.