Given an array of positive and negative integers, re-arrange it so that you have positive integers on one end and negative integers on other, but retain their order of appearance in the original array.
For example given: arr = [2, -12, 4, 46, -20, -1] The answer should be: arr = [-12, -20, -1, 2, 4, 46]
How can I arrange the array this way in JavaScript?
Thanks.