Sorting Array with JavaScript reduce function

in sthink •  7 years ago 

Often I study some JavaScript interview questions, suddenly I saw a question about usage of reduce function for sorting an Array, I read about in MDN and the usage of it in some medium articles, But sorting an Array is so Innovative:

const arr = [91,4,6,24,8,7,59,3,13,0,11,98,54,23,52,87,4];

I thought a lot, but I've no idea about how answer this question, how must be the reduce call back function? what is the initialValue of reduce function? and what are the accumulator and currentValue of call back function of reduce?

And at the end, Does this way have some benefits than other sorting algorithms? Or Is it useful to improve other algorithms?

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!