Hardened The check-the-length-property-of-a-string-variable challenge to make it hard to get no tests run

This commit is contained in:
benmcmahon100
2015-08-03 17:01:27 +01:00
parent 8be776a6a7
commit c9c2a74461

View File

@ -121,23 +121,26 @@
"For example, if we created a variable <code>var firstName = \"Julie\"</code>, we could find out how long the string \"Julie\" is by using the <code>firstName.length</code> property." "For example, if we created a variable <code>var firstName = \"Julie\"</code>, we could find out how long the string \"Julie\" is by using the <code>firstName.length</code> property."
], ],
"tests": [ "tests": [
"assert((function(){if(typeof(lastNameLength) != 'undefined' && typeof(lastNameLength) == 'number' && lastNameLength == 4){return(true);}else{return(false);}})(), 'lastNameLength should be equal to four')" "assert((function(){if(typeof(lastNameLength) != 'undefined' && typeof(lastNameLength) == 'number' && lastNameLength == 4){return(true);}else{return(false);}})(), 'lastNameLength should be equal to four')",
"assert((function(){if(editor.getValue().match(/\\.length/gi).length >= 2 && editor.getValue().match(/var lastNameLength \\= 0;/gi).length >= 1){return(true);}else{return(false);}})(), 'You should be getting the length of <code>lastName</code> by using .length like this <code>lastName.length</code>');"
], ],
"challengeSeed": [ "challengeSeed": [
"var firstNameLength = 0;",
"var lastNameLength = 0;",
"var firstName = \"Madeline\";", "var firstName = \"Madeline\";",
"", "",
"var firstNameLength = firstName.length;", "firstNameLength = firstName.length;",
"", "",
"var lastName = \"Chen\";", "var lastName = \"Chen\";",
"", "",
"var lastNameLength = lastName;", "lastNameLength = lastName;",
"", "",
"", "",
"", "",
"// You can ignore this.", "// You can ignore this.",
"// We use this to show you the value of your variable in your output box.", "// We use this to show you the value of your variable in your output box.",
"// We'll learn about functions soon.", "// We'll learn about functions soon.",
"if(typeof(lastNameLength) != 'undefined')(function(v){return(v);})(lastNameLength);}" "if(typeof(lastNameLength) != 'undefined'){(function(v){return(v);})(lastNameLength);}"
], ],
"challengeType": 1 "challengeType": 1
}, },