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

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. Commented Apr 13, 2020 at 14:16
  • pastebin.com/K4phN07m Commented Apr 13, 2020 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. Commented Apr 13, 2020 at 14:55

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.