You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//a). Define an anonymous function and set it equal to a variable with a normal, non-suspicious name. The function takes one parameter. This will be the fuel level on the shuttle.
31
38
32
39
//b). You must siphon off fuel without alerting the TAs. Inside your function, you want to reduce the fuel level as much as possible WITHOUT changing the color returned by the checkFuel function.
33
40
34
41
//c). Once you figure out how much fuel to pump out, return that value.
35
42
36
43
//d). Decide where to best place your function call to gather our new fuel.
44
+
letnonSuspiciousFunction=function(a){
45
+
if(checkFuel(a)==="green"){
46
+
returna-100001;
47
+
}elseif(checkFuel(a)==="yellow"){
48
+
returna-50001;
49
+
}else{
50
+
returna;
51
+
}
52
+
};
53
+
54
+
fuelLevel=nonSuspiciousFunction(fuelLevel);
55
+
//placed above at line 23
37
56
38
-
/*Next,liberatesomeofthatgloriouscargo.
39
-
*/
57
+
// Next, liberate some of that glorious cargo.
40
58
41
59
//a). Define another anonymous function with an array as a parameter, and set it equal to another innocent variable.
0 commit comments