function* comparePrice(){
while(true){
yield Math.random()*100
}
}
var limitPrice = 50
var price = 100
while(price > limitPrice){
console.log(`this is price ${price}`)
price = comparePrice().next().value
}
console.log(`this is lastPrice ${price}`)
// this is price 62.20384758361717
// this is lastPrice 32.9677543460043
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交