0

This might not even be an actual question, just a curiosity. I am currently learning up on array.sort() from MDN-Array.Sort(). It says in the 'Return Value': "The sorted array. Note that the array is sorted in place, and no copy is made." So my question is could you make a copy of it? and if so how? and if not, why? My apologies in advance if this seems like a ridiculous question, I am just trying to learn the methods as I go.

Many Thanks

Dr Gaud
  • 97
  • 3
  • "copy" not in the sense of a printed paper or a file on your computer. Copy in the sense that the array would exist twice in memory. You can copy arrays with `.slice`. – Jonas Wilms Apr 13 '20 at 14:16
  • https://pastebin.com/K4phN07m – TJBlackman Apr 13 '20 at 14:19
  • aye, basically I thought if there was a way to have the new sorted array saved on a file somewhere as an output, if that was at all possible. However I was looking over the examples given by @TJBlackman and kind of have a better understanding of how the array.sort() method works. – Dr Gaud Apr 13 '20 at 14:55

0 Answers0