I have a series of numbers in a string, such as "3 -1 0 5"
. My goal is to create another string that lists the missing numbers from the original sequence once it has been sorted. For example, if the original array is sorted as [-1, 0, 3, 5]
, then the missing numbers would be [1, 2, 4]
.
I want to find an efficient solution using modern JavaScript techniques, beyond just using methods like split
, parse
, and sort
. I am looking to utilize concepts like looping through a range of numbers with min..max
, checking for certain conditions such as index -1
, and adding elements using push
.