js generates a random number and display inside the loop

// generates a random number 
randomNumBoth (Min, Max) { var the Range = Max - Min var Rand = Math.random () var NUM = Min + Math.round (Rand the Range *) // rounded return NUM }

  

let that = this;
let datas = [];
for (let i = 0; i < that.merchantList.length; i++) {
let datai = that.randomNumBoth(99,96)
datas.push(datai)
}
console.log(datas)
that.dataArr = datas

<View class = "add"> {{dataArr [index]}}% of people are concerned </ view>

 

Guess you like

Origin www.cnblogs.com/Glant/p/12165814.html