“Hard coded” means relying on specific values instead of variables. In this case, the requirement exists because many people tried solving this problem by referencing globalArray instead of using arr. In your case, the fact that you are copying arr into arr2 and using arr2 in your return is falsely triggering that check. If you remove var2 =[...arr]; and use arr in your return statement, you’ll pass the tests.
Bugs like this can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it.
@ArielLeslie Thank You for your reply.
I had already tried the same direclty with arr.And it didnt work.So I thought somehow it may be mutating the global Array.And thus I tried out this way.
Perhaps its a bug.
@ArielLeslie I know when you read the following you would not believe.
But this happened…
I cut the required code…Reset the code…(thus all comments were deleted)…And pasted it again…
And Booom!It ran all the way!!