// Use a simple spread operator with the arguments function ArrangeInOrder(...args) { args.sort(); return args; } ArrangeInOrder(1,4,3,9,5,3,6,2,8,7,5,9,3,7); // << [1, 2, 3, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 9]