Skip to content

Commit 403e47e

Browse files
Temp fix for #269
So the problem is because we define variables based off the name the user gives us, and if they use a hypen or space in the challenge, it'll cause that code to do a flip. Until I can think of a way to detect when they pass that non-string version of their name into `alert`, we're just going to not do that and give them the no alert error message.
1 parent ab5e3de commit 403e47e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

courses/intro/3_string_function_parameter.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@ describe('console.log example', function() {
77
before(function() {
88
var setup = "var _alertCalled = false; var _alertVal; var _alert = alert;";
99
setup += "alert = function(val) { _alertVal = val; _alertCalled = true; return _alertVal === '__wrong__' ? false : _alert(val); };";
10-
setup += "var " + js.state.username + " = '__wrong__';";
11-
setup += "var " + js.state.username.toLowerCase() + " = '__wrong__';";
1210
js.evaluate(setup);
1311
12+
var setupNames = "var " + js.state.username + " = '__wrong__';";
13+
setupNames += "var " + js.state.username.toLowerCase() + " = '__wrong__';";
14+
15+
try {
16+
js.evaluate(setupNames);
17+
} catch(e) {}
18+
1419
try {
1520
message = js.evaluate(code);
1621
} catch(e) {

0 commit comments

Comments
 (0)