From e0db3181d399007c010e8da85bef1147c0bae66f Mon Sep 17 00:00:00 2001 From: bugron Date: Tue, 8 Sep 2015 17:21:12 +0400 Subject: [PATCH] fixes an idle test and some text --- seed/challenges/basic-javascript.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index da1c55830e3..f4c0377b50f 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -974,13 +974,14 @@ "Create an if-else statement to return heads if the flip var is zero, or else return tails if it's not." ], "tests":[ - "assert((function(){if(myFunction() === \"heads\" || myFunction() === \"tails\"){return true;}else{return false;}})(), 'myFunction should either return heads or tails');", - "assert(editor.getValue().match(/if/g).length >= 3, 'You should have created a new if statement');", - "assert(editor.getValue().match(/else/g).length >= 2, 'You should have created a new else statement');" + "assert((function(){var result = myFunction();if(result === 'heads' || result === 'tails'){return true;} else {return false;}})(), 'myFunction should either return heads or tails.');", + "assert((function(){var result = myFunction();if(result === 'heads' && flip === 0 || result === 'tails' && flip !== 0){return true;} else {return false;}})(), 'myFunction should return heads when flip equals 0 and tails when flip equals 1.');", + "assert(editor.getValue().match(/if/g).length >= 4, 'You should have created a new if statement.');", + "assert(editor.getValue().match(/else/g).length >= 2, 'You should have created a new else statement.');" ], "challengeSeed":[ + "var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;", "function myFunction(){", - " var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;", " // Create an if-else statement here to return \"heads\" if flip is 0. Otherwise return \"tails\".", "", " // Only change code below this line.", @@ -990,7 +991,7 @@ "", "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", - "(function(){return myFunction();})();" + "var result = myFunction();if(typeof(flip) !== \"undefined\" && typeof(flip) === \"number\" && typeof(result) !== \"undefined\" && typeof(result) === \"string\"){(function(y,z){return 'flip = ' + y.toString() + ', text = ' + z;})(flip, result);}" ], "type": "waypoint", "challengeType": 1