Write a JavaScript function that processes the elements in an array one by one and produces a new array.
Prepend each negative element at the front of the result and append each positive (or 0) element at the end of the result.
The input comes as array of number elements.
Examples:
Input:
[7, -2, 8, 9]
Output:
-2
7
8
9
Input:
[3, -2, 0, -1]
Output:
-1
-2
3
0
The output is printed on the console, each element on a new line.