diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json
index 5e740784d4..7dc93e98fb 100644
--- a/challenges/basic-javascript.json
+++ b/challenges/basic-javascript.json
@@ -1066,10 +1066,10 @@
"Let's use this technique to generate and return a random whole number between 0 and 9."
],
"tests": [
- "assert(typeof(myFunction()) === \"number\", 'message: The result of myFunction
should be a number.');",
- "assert(editor.getValue().match(/Math.random/g), 'message: You should be using Math.random to generate a random number.');",
+ "assert(typeof(myFunction()) === \"number\" && (function(){var r = myFunction();return Math.floor(r) === r;})(), 'message: The result of myFunction
should be a whole number.');",
+ "assert(editor.getValue().match(/Math.random/g).length > 1, 'message: You should be using Math.random
to generate a random number.');",
"assert(editor.getValue().match(/\\(\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\*\\s*?10\\s*?\\)/g) || editor.getValue().match(/\\(\\s*?10\\s*?\\*\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\)/g), 'message: You should have multiplied the result of Math.random
by 10 to make it a number that is between zero and nine.');",
- "assert(editor.getValue().match(/Math.floor/g), 'message: You should use Math.floor
to remove the decimal part of the number.');"
+ "assert(editor.getValue().match(/Math.floor/g).length > 1, 'message: You should use Math.floor
to remove the decimal part of the number.');"
],
"challengeSeed": [
"var randomNumberBetween0and19 = Math.floor(Math.random() * 20);",
@@ -1081,8 +1081,9 @@
" return Math.random();",
"",
" // Only change code above this line.",
- "}",
- "",
+ "}"
+ ],
+ "tail":[
"(function(){return myFunction();})();"
],
"type": "waypoint",