Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
也许您可以避免使用三元运算符重写分配语句:
let rdm = Math.random() * 100 const firstCase = 19.37 / NewData.PriceDivider const secondCase = 19.37 / 100 / (5.18 / NewData.PriceDivider) // Handle rdm === 100 here if (rdm === 100) // do something Rarity = rdm < firstCase ? Rarities.uncommon : rdm < secondCase ? Rarities.common : Rarities.basic Embed.addField("Rarity", Rarity, true); Embed.setColor(rdm < firstCase ? "GREEN" : "GREY");
如果要处理Math.random()=== 1的情况,我认为您应该在此代码块之前对其进行处理。
Maybe you could avoid rewriting the assignment statements by using ternary operator :
If you want to handle the case where Math.random() === 1, I think you should handle it before this code block.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)
也许您可以避免使用三元运算符重写分配语句:
如果要处理Math.random()=== 1的情况,我认为您应该在此代码块之前对其进行处理。
Maybe you could avoid rewriting the assignment statements by using ternary operator :
If you want to handle the case where Math.random() === 1, I think you should handle it before this code block.