My task is to return the maximum and minimum in the string. Everything would work, but this string, not an array. How can I convert one to another? Help. Or there is another solution about which I do not know, here is my option for the array:
var numbers = [5, 6, 2, 3, 7]; var max = Math.max.apply(null, numbers); var min = Math.min.apply(null, numbers); alert(min); alert(max); UPD: example string:
highAndLow ("1 2 3 4 5"); // should return the string "5 1"
those. I can't write a function:
function highAndLow(numbers){ // ... }