I am looking to copy the substring of a string array into a new array without creating references. This is giving me a headache yet this should be fairly simple.
I tried NewArray[n] = OldArray[n].substr(x,y).slice(0)
inside a loop and does not work. (I need to do a NewArray.sort()
afterwards).
For the sake of example, say I got an OldArray
with 2 elements:
['River', 'Lake']
I want the new array to be made of the first 2 characters (substring) of the old one such that:
['Ri', 'La']