Skip to main content

Timeline for Sever-sort an array

Current License: CC BY-SA 3.0

8 events
when toggle format what by license comment
Dec 22, 2016 at 4:50 comment added ETHproductions And since z is the second parameter in the function, when f(a,q) is called, f sees it as z. Hope this helps!
Dec 22, 2016 at 4:49 comment added ETHproductions @obarakon Well, f=([n])=>... would only capture the first element, and f=([n,a])=>... would capture only the first in n and the second in a. Another way to do what f=([n,...a])=>,,, does would be f=a=>(n=a.unshift(),....
Dec 22, 2016 at 0:21 comment added Oliver Thank you. That was very helpful. Since your first parameter is an array, why do you need to include the ...a? Is that just so you can take advantage of n? One more thing, when you call f(a,q), does q get set to the parameter z?
Dec 22, 2016 at 0:12 comment added ETHproductions @obarakon Correct. n is the first item in the array, and a is the rest of the array. You can find more info here.
Dec 22, 2016 at 0:05 comment added Oliver Can you explain how your array gets parsed into your first parameter [n,...a]. What is n? Is that just the first item in your array?
Dec 21, 2016 at 23:41 history edited ETHproductions CC BY-SA 3.0
added explanation
Dec 21, 2016 at 23:14 history edited ETHproductions CC BY-SA 3.0
added snippet
Dec 21, 2016 at 22:59 history answered ETHproductions CC BY-SA 3.0