Within the challenges, there is an area for Test Output.
However, when students update the JavaScript to meet the challenge, nothing will show in the Test Output area without the addition of appropriate console.log notations added to the Javascript.
Yes, the function may execute behind the scenes; but we the users won’t actually see the result without console.log(s).
Students should be made aware of this!
Example: Counting Cards lesson/challenge
The code should include the 2 console.log notations that I have made below…
var count = 0;
function cc(card) {
// Only change code below this line
switch (card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count--;
break;
}
if (count > 0) {
console.log(count, " Bet");
return count + " Bet";
} else {
console.log(count, " Hold");
return count + " Hold";
}
// Only change code above this line
}
// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
By adding the console.logs, the Test Output area will yield what shows below – allowing students to immediately determine whether or not they are achieving the challenge correctly BEFORE hitting the “Run the Tests” button.
1 Bet
2 Bet
2 Bet
1 Bet
0 Hold