Browse Source

module2 FE8 fix

Ivan Asmer 7 years ago
parent
commit
b56c88e091
1 changed files with 3 additions and 2 deletions
  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)
 ```