Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
W6D1 Debugging Exercises
// Why does this fail?
var a = 0;
//if comparator was using equal only '='
if (a === 1) {
console.log("I Shouldn't be in here!");
} else {
console.log("I Should be in here!");
}
// Why does the if go off and not the switch?
var myVar = 5;
//if comparator was using double equal only '=='
if(myVar === '5')
{
alert("If Alert");
}
switch(myVar)
{
case '5':
alert("Switch Alert");
}
// Why is this broken?
var mySuperAwesomeVariableName = "Ted Mosby";
mySuperAwesomeVariableName = "BATMAN!"; //missing capital mySuper....
console.log(mySuperAwesomeVariableName);
// What's missing? How does JS interpret empty line endings?
//missing backslash to continue line statement
var bad = '<ul id="myId"> \
<li>some text</li> \
<li>more text</li> \
</ul>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment