The comparison function must be either a function or undefined: [object Array]

technical talkiess
0

 index.html:28 Javascript Array

index.html:57 Uncaught TypeError: The comparison function must be either a function or undefined: [object Array]

    at Array.sort (<anonymous>)

    at index.html:57:25

(anonymous) @ index.html:57




Error code:- 

console.log(arr.sort(arr))

        console.log(arr)


Solution code:- 

console.log(arr.sort())

        console.log(arr)


Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)