/* In this little assignment you are given a string of space separated numbers, and have to return the highest and lowest number. */ function highAndLow(numbers){ // 2147483648 // ... let lo = 2147483648; let hi = -2147483648; numbers.split(" ").forEach(each=>{ let num = Number(each); lo = Math.min(lo, num); hi = Math.max(hi, num); }) return hi.toString() + " " + lo.toString(); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter