1 of 10

ScriptEd Advanced Course

Topic: Debugging

ScriptEd lesson slides

ScriptEd

2 of 10

Whiteboard Challenge Solutions

ScriptEd

3 of 10

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

4 of 10

We Do - Find the bug

There are few bugs in the following popcode app. Help me fix them.

https://popcode.org/?gist=4e18cc99572229072456729115d9642b

ScriptEd

5 of 10

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

6 of 10

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

7 of 10

Debugging

ScriptEd

8 of 10

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

9 of 10

Exercise - Expected Output

ScriptEd

10 of 10

Exit Ticket

  1. Write three ideas for a project that you would like to work on (e.g., web app, game, web store, etc.)
  2. We will introduce the Entrepreneurial project next week.

ScriptEd