We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
in TS, when I write the sort method with the callback function, it works. But when i use the default parameter or call .reverse(), It doesn't work. I don't understand.
A.sort((a,b)=> a-b)[[[[[
B.sort((a,b)=> b-a)
works :D
as opposed to
A.sort()
B.sort().revers()
doesn't work :(
Is it not the same thing??
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Permuting Two Arrays
You are viewing a single comment's thread. Return to all comments →
in TS, when I write the sort method with the callback function, it works. But when i use the default parameter or call .reverse(), It doesn't work. I don't understand.
A.sort((a,b)=> a-b)[[[[[ B.sort((a,b)=> b-a)
works :D as opposed to
A.sort() B.sort().revers()
doesn't work :( Is it not the same thing??