I'm a JS newcomer. I have a scrambled array of numbers and need to convert random positive values of the array into negative. At that point I only know how to randomize the array:
var myArray = [1,2,3,4,5,6,7,8,9,10];
myArray.sort(function() {
return 0.5 - Math.random()
})
But need the result look something like this: [8,-2,3,9,-5,-1,4,7,6,-10]
Please suggest. Thank you!