ScriptEd Advanced Course
Topic: Debugging
ScriptEd lesson slides
ScriptEd
Whiteboard Challenge Solutions
ScriptEd
Do Now - Find the bug
Requirement: Need function that takes in single input, and if that input is equal to ‘moth’, it prints ‘moth in relay’ otherwise it prints ‘No bug’.
function remove_bug(input){
var bug_check = 'beetle';
if (input == bug_check){
console.log(bug_check + " in relay");
}
else {
console.log("No bug")
}
}
ScriptEd
We Do - Find the bug
There are few bugs in the following popcode app. Help me fix them.
https://popcode.org/?gist=4e18cc99572229072456729115d9642b
ScriptEd
Debugging
What is a bug?
A software bug is an error, flaw, failure or fault in a computer program or system that causes it to produce an incorrect or unexpected result, or to behave in unintended ways.
Is that it?
Source: https://en.wikipedia.org/wiki/Software_bug
ScriptEd
Debugging
Why bug?
On September 9, 1945, U.S. Navy officer Grace Hopper found a moth between the relays on the Harvard Mark II computer she was working on.
Source: https://thenextweb.com/shareables/2013/09/18/the-very-first-computer-bug/#.tnw_dQdMpNLq
ScriptEd
Debugging
ScriptEd
Exercise - Get all the bugs
Find all the bugs in: https://jsbin.com/gusihiy/60/edit?html,js,output
If you finish the bugs above, debug this addition calculator: http://jsbin.com/bapeboramu/edit?html,js,output
Resources:
ScriptEd
Exercise - Expected Output
ScriptEd
Exit Ticket
ScriptEd