Find all ranges of consecutive numbers in array : <p>Given a sorted array of numbers, how do you get ranges of consecutive numbers? The function should return ranges and single numbers as a string. Example:</p>

<pre><code>function findRanges(arrayOfSortedNumbers) {
  // logic here
}

findRanges([1, 3, 4, 5, 7]) =&gt; (expected output: "1, 3-5, 7")

findRanges([1, 2, 3, 5]) =&gt; (expected output: "1-3, 5")

findRanges([2, 3, 4, 5, 6]) =&gt; (expected output: "2-6")
</code></pre>

<p>Sorry for not being able to explain the problem better.</p>
