Skip to content

Commit

Permalink
Fix accepting incorrect answer
Browse files Browse the repository at this point in the history
Make min nonzero value
Alter the last test to accept only correct answers
  • Loading branch information
sanspace committed Oct 18, 2015
1 parent af654ae commit 6e41fc1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions seed/challenges/basic-javascript.json
Original file line number Diff line number Diff line change
Expand Up @@ -934,10 +934,10 @@
"assert(myFunction() >= min, 'message: The random number generated by <code>myFunction</code> should be greater than or equal to the minimum number.');",
"assert(myFunction() <= max, 'message: The random number generated by <code>myFunction</code> should be less than or equal to the maximum number.');",
"assert(myFunction() % 1 === 0 , 'message: The random number generated by <code>myFunction</code> should be an integer, not a decimal.');",
"assert((function(){if(editor.getValue().match(/max/g).length >= 2 && editor.getValue().match(/min/g).length >= 2 && editor.getValue().match(/Math.floor/g) && editor.getValue().match(/Math.random/g)){return true;}else{return false;}})(), 'message: You should be using the function given in the description to calculate the random in number in a range.');"
"assert((function(){if(editor.getValue().match(/max/g).length >= 3 && editor.getValue().match(/min/g).length >= 4 && editor.getValue().match(/Math.floor/g) && editor.getValue().match(/Math.random/g)){return true;}else{return false;}})(), 'message: You should be using the function given in the description to calculate the random in number in a range.');"
],
"challengeSeed":[
"var min = 0;",
"var min = 1;",
"var max = 9;",
"function myFunction() {",
" // Make myFunction return a random number between min and max values instead of a decimal",
Expand Down

0 comments on commit 6e41fc1

Please sign in to comment.