瀏覽代碼

module2 FE8 fix

Ivan Asmer 7 年之前
父節點
當前提交
b56c88e091
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      module_.md

+ 3 - 2
module_.md

@@ -9,10 +9,11 @@ $("h2").each(function(){
 
 var rate = 10;
 var randomValues = tasks.map(function(item){
-    return Math.random()*(10-(rate - item.weight))
+    return Math.random()*(10-Math.abs(rate - item.weight))
 })
 
-alert(tasks[randomValues.indexOf(Math.max.apply(Math, randomValues))].name)
+//alert(tasks[randomValues.indexOf(Math.max.apply(Math, randomValues))].name)
+alert(tasks.splice(randomValues.indexOf(Math.max.apply(Math, randomValues)),1)[0].name)
 ```