There definitely is a lot more "prep" work to do in order to use sort.Sort(). I still like the idea of sorting custom types instead of just arrays. Plus, it's a really nice way to see how these sorts work under the hood in Go. I guess Go and Javascript work in different ways :P
That being said, for simple arrays, you could just use the three functions listed above such as Ints, Float64s, or Strings!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is not particularly simple, at least, compared to the sort function in js
[3,2,1].sort((a, b) => a - b)
There definitely is a lot more "prep" work to do in order to use
sort.Sort()
. I still like the idea of sorting custom types instead of just arrays. Plus, it's a really nice way to see how these sorts work under the hood in Go. I guess Go and Javascript work in different ways :PThat being said, for simple arrays, you could just use the three functions listed above such as
Ints
,Float64s
, orStrings
!