From 501c63fc29fc6f2815026863734f18c5f12ac9ab Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Srinivasan Date: Sun, 18 Oct 2015 13:44:17 +0530 Subject: [PATCH] Fix accepting incorrect answer Make min nonzero value Alter the last test to accept only correct answers --- challenges/basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json index e215cddda0..a513d72ade 100644 --- a/challenges/basic-javascript.json +++ b/challenges/basic-javascript.json @@ -934,10 +934,10 @@ "assert(myFunction() >= min, 'message: The random number generated by myFunction should be greater than or equal to the minimum number.');", "assert(myFunction() <= max, 'message: The random number generated by myFunction should be less than or equal to the maximum number.');", "assert(myFunction() % 1 === 0 , 'message: The random number generated by myFunction 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",