Last active
August 29, 2015 14:18
-
-
Save Andsbf/1ad7c215e708f720e10d to your computer and use it in GitHub Desktop.
W6D1 Debugging Exercises
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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!"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Why is this broken? | |
var mySuperAwesomeVariableName = "Ted Mosby"; | |
mySuperAwesomeVariableName = "BATMAN!"; //missing capital mySuper.... | |
console.log(mySuperAwesomeVariableName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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