Skip to content

Instantly share code, notes, and snippets.

@Andsbf
Last active August 29, 2015 14:18
Show Gist options
  • Save Andsbf/1ad7c215e708f720e10d to your computer and use it in GitHub Desktop.
Save Andsbf/1ad7c215e708f720e10d to your computer and use it in GitHub Desktop.
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