Task: Implement Non-Mutating Array Sort in JavaScript
Task: Implement Non-Mutating Array Sort in JavaScript: a task in Terminal-Lego-15k (Harbor dataset). Your task is to implement a JavaScript function that sorts an array without mutating the original array . The function should return a new sorted array while leaving the input array unchanged.
The task
Your task is to implement a JavaScript function that sorts an array **without mutating the original array**. The function should return a new sorted array while leaving the input array unchanged.
Part of PrimeIntellect/Terminal-Lego-15k.