I have an array like:
var array = [1, 2, undefined, undefined, 7, undefined]
and need to replace all undefined
values with "-"
. The result should be:
var resultArray = [1, 2, "-", "-", 7, "-"]
I think there is a simple solution, but I couldn't find one.