Positive Number to Negative Number in JavaScript?

后端 未结 13 1735
误落风尘
误落风尘 2020-12-13 05:16

Basically, the reverse of abs. If I have:

if ($this.find(\'.pdxslide-activeSlide\').index() < slideNum - 1) {
  slideNum = -slideNum
}
console.log(slideNu         


        
13条回答
  •  感动是毒
    2020-12-13 05:59

    It will convert negative array to positive or vice versa

    function negateOrPositive(arr) {
        arr.map(res => -res)
    };
    

提交回复
热议问题