Turn array containing array of numbers into formatted version [duplicate]

Trying to solve this puzzle in JavaScript:

Input: An array containing x amoung of arrays of numbers. Heres example:

[
[1,4],
[6,8],
[10]
]

Expected Output: I would want to run some sort of code to turn it into:

1-4,6-8,10

I’ve tried join(“-“) and tried the same thing within a forEach() loop but can’t quite get it to work

Any help is appreciated!