Browse Source

module2 FE8 fix

Ivan Asmer 7 năm trước cách đây
mục cha
commit
b56c88e091
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  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)
 ```