Week 4 Recitation – Walk Exercise – Nan

URLhttp://imanas.shanghai.nyu.edu/~js9686/w04-exercise-JS-Conditionals/index.html

Date: March 7 2019

Description:

Two problems aroused here:

if (clicking == 1){
     **************
} else if (clicking == 2){
     **************
} else if (clicking == 3) {
     **************
}else{
     clicking = 0;
}

a. I innitially used clicking = 1/2/3, but it failed: single = is for assigning, and double == is for comparing.

b. I changed the = into ==, but the number, according to consolog, goes “1, 2, 3, 4,  1, 2, 3, 4.” There is an extra “4.” I the realised that I shouldn’t use “else” at the last section because once it run into “else,” the clicking number has already reached “4.”

Leave a Reply