I have a function that takes a string of numbers and returns the highest and lowest number.
Function:
function highAndLow(numbers){
var split = numbers.split(' ').map(Number);
var min = Math.min.apply(null, split).toString()
var max = Math.max.apply(null, split).toString()
var empty = ""
var x = empty.concat(max, min).split("").join("");
return x
}
highAndLow("1 9 3 4 -5"); // return "9 -5"
The problem is at the moment it is returning "9-5"
and I need it to return "9 -5"