From 836bb187b97aee931767d71f7b7a64c36788a4f8 Mon Sep 17 00:00:00 2001 From: Barry Lew <36746836+grendel108@users.noreply.github.com> Date: Sat, 10 Mar 2018 12:34:06 -0800 Subject: [PATCH 01/14] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b8c05c1..1d4eae7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +Barry + # Debugging Report Template After forking this project on GitHub, edit this file to replace where it says `Your answer here...` under each section below with your actual answers to each prompt while you strategically hunt for bugs! From 3d8e6229ae571728e0fd27b1a22145f73a178c0b Mon Sep 17 00:00:00 2001 From: Barry Lew <36746836+grendel108@users.noreply.github.com> Date: Sun, 11 Mar 2018 20:28:08 -0700 Subject: [PATCH 02/14] Update README.md --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 1d4eae7..4575acc 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,12 @@ Even if you feel like you have *no idea*, take a guess! What are some possible i ``` Your answer here... +1. The a on line 4 might not be a string. + + ``` +
### 2. Log your questions: what do you need to find out? @@ -27,10 +31,14 @@ Write down a list of questions that you have related to your specific hypothesis **Example:** *"What is this textContent thing? Is the C supposed to be capitalized? Is it missing a letter?"* +
``` Your list of questions here.... +1. Is "a" being correctly assigned as a string? What is the proper way to to designate a string? Double-quotes or single quotes? + + ```
@@ -45,6 +53,11 @@ This step isn't needed for every hypothesis (depends what it is!), but if applic ``` Your list of findings here... +1. It looks like JavaScript doesn't distinguish between double-quoted strings and single-quoted strings. + +https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String + + ```
@@ -62,6 +75,8 @@ If applicable to your hypothesis, write a **list of steps** for how you changed ``` Your list of steps to run your experiment... +1.a. Change to single-quoted string to see if a is recognized as the correct answer. + ```
@@ -76,6 +91,8 @@ What was the result of your experiment? Did it solve the bug or not? Did it crea ``` Your results here... +1. Changing to single-quotes did not make a difference. The correct answer is still not trigger the correct message. + ```
@@ -90,6 +107,8 @@ Did this experiment *confirm* your hypothesis? Or would you say this result is i ``` Your conclusion here... +1. Hypothesis is wrong since as the documentation explains, single-quoted and double-quoted strings work the same way. + ```
From 13f29a93375d5609e259d4f8295dae4343e75320 Mon Sep 17 00:00:00 2001 From: Barry Lew <36746836+grendel108@users.noreply.github.com> Date: Sun, 11 Mar 2018 20:41:22 -0700 Subject: [PATCH 03/14] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4575acc..f08fe59 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Even if you feel like you have *no idea*, take a guess! What are some possible i ``` Your answer here... 1. The a on line 4 might not be a string. +2. The strict === vs. lazy == equal sign may not be comparing our answer correctly with the assigned value. ``` @@ -37,6 +38,7 @@ Write down a list of questions that you have related to your specific hypothesis ``` Your list of questions here.... 1. Is "a" being correctly assigned as a string? What is the proper way to to designate a string? Double-quotes or single quotes? +2. What exactly is happening when === is used vs. ==? ``` From c2d88a74f5f5313984e4e6c79fc4a5d61e6896e9 Mon Sep 17 00:00:00 2001 From: Barry Lew <36746836+grendel108@users.noreply.github.com> Date: Sun, 11 Mar 2018 20:42:54 -0700 Subject: [PATCH 04/14] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index f08fe59..e367dd7 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,11 @@ Your list of findings here... https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String +2. === is true only if the operands are of the same type and value. == converts them to the same type and then makes the comparison of values. + +https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators + + ``` From 6de85496aa0a2300f5a7e1a2d4d9e1fbe238c69a Mon Sep 17 00:00:00 2001 From: Barry Lew <36746836+grendel108@users.noreply.github.com> Date: Sun, 11 Mar 2018 20:46:42 -0700 Subject: [PATCH 05/14] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e367dd7..f4790ca 100644 --- a/README.md +++ b/README.md @@ -82,8 +82,9 @@ If applicable to your hypothesis, write a **list of steps** for how you changed ``` Your list of steps to run your experiment... -1.a. Change to single-quoted string to see if a is recognized as the correct answer. +1. Change to single-quoted string to see if a is recognized as the correct answer. +2. If "a" in the assignment is not the same as a in the form, then == should take care of the possibly different types and then compare the values, which are the same. ```
@@ -100,6 +101,8 @@ What was the result of your experiment? Did it solve the bug or not? Did it crea Your results here... 1. Changing to single-quotes did not make a difference. The correct answer is still not trigger the correct message. +2. Using == does not make a difference. It's still displaying the wrong message. + ```
@@ -116,6 +119,7 @@ Did this experiment *confirm* your hypothesis? Or would you say this result is i Your conclusion here... 1. Hypothesis is wrong since as the documentation explains, single-quoted and double-quoted strings work the same way. +2. Hypothesis not confirmed. == did not make a difference. ```
From cc1a0802d0ee2ab4a66733e5ecf955123884099c Mon Sep 17 00:00:00 2001 From: Barry Lew <36746836+grendel108@users.noreply.github.com> Date: Sun, 11 Mar 2018 20:52:00 -0700 Subject: [PATCH 06/14] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f4790ca..de24ad1 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Even if you feel like you have *no idea*, take a guess! What are some possible i Your answer here... 1. The a on line 4 might not be a string. 2. The strict === vs. lazy == equal sign may not be comparing our answer correctly with the assigned value. - +3. Line 8: The value that the user typed in might not be captured properly. ``` @@ -38,8 +38,10 @@ Write down a list of questions that you have related to your specific hypothesis ``` Your list of questions here.... 1. Is "a" being correctly assigned as a string? What is the proper way to to designate a string? Double-quotes or single quotes? + 2. What exactly is happening when === is used vs. ==? +3. What "value" is being captured on Line 8? The value that the user entered or the value of the id? After identifying the id of the user input element, is "value" the correct way to get the value of what the user entered? ``` From ee2fb31be73acf5678f6395d6412f72b3b075251 Mon Sep 17 00:00:00 2001 From: Barry Lew <36746836+grendel108@users.noreply.github.com> Date: Sun, 11 Mar 2018 21:11:54 -0700 Subject: [PATCH 07/14] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index de24ad1..4446f06 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,13 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators +3. getElementById returns an Element, which would be the input box. Is there a method in Element that would return what's in the box? +https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById +https://developer.mozilla.org/en-US/docs/Web/API/Element + +It looks like .value assigns a value to the form box rather than gets the value. Wait, it depends. You can assign a value or return a value. +https://www.w3schools.com/jsref/prop_text_value.asp ``` From 5e8c10c612cf0cd8df2b2ddd892ff7a0132a3f99 Mon Sep 17 00:00:00 2001 From: Barry Lew <36746836+grendel108@users.noreply.github.com> Date: Sun, 11 Mar 2018 21:23:05 -0700 Subject: [PATCH 08/14] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 4446f06..72edd73 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,8 @@ Your list of steps to run your experiment... 1. Change to single-quoted string to see if a is recognized as the correct answer. 2. If "a" in the assignment is not the same as a in the form, then == should take care of the possibly different types and then compare the values, which are the same. + +3. Even changing Line 26 to a literal answer of "a" without a variable doesn't result in the correct message. ```
@@ -111,6 +113,8 @@ Your results here... 2. Using == does not make a difference. It's still displaying the wrong message. +3. It's still displaying the wrong message. + ```
@@ -128,6 +132,8 @@ Your conclusion here... 1. Hypothesis is wrong since as the documentation explains, single-quoted and double-quoted strings work the same way. 2. Hypothesis not confirmed. == did not make a difference. + +3. Hypothesis is confirmed in that the correct value is being captured since according to the documentation .value returns a string, so we know that what is being typed into the box returns a string even if a number were typed. ```
From 3f7151bf51aba8e6f8c1bc3c6934b9f99dad0c3a Mon Sep 17 00:00:00 2001 From: Barry Lew <36746836+grendel108@users.noreply.github.com> Date: Sun, 11 Mar 2018 21:38:44 -0700 Subject: [PATCH 09/14] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 72edd73..eaac33e 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Your answer here... 1. The a on line 4 might not be a string. 2. The strict === vs. lazy == equal sign may not be comparing our answer correctly with the assigned value. 3. Line 8: The value that the user typed in might not be captured properly. +4. Line 8 is not evaluating to True. ``` @@ -43,6 +44,7 @@ Your list of questions here.... 3. What "value" is being captured on Line 8? The value that the user entered or the value of the id? After identifying the id of the user input element, is "value" the correct way to get the value of what the user entered? +4. What if I set Line 26 to true? ```
@@ -95,6 +97,8 @@ Your list of steps to run your experiment... 2. If "a" in the assignment is not the same as a in the form, then == should take care of the possibly different types and then compare the values, which are the same. 3. Even changing Line 26 to a literal answer of "a" without a variable doesn't result in the correct message. + +4. Setting Line 26 to true will always result in correct answer, no matter what I type. ```
@@ -134,6 +138,8 @@ Your conclusion here... 2. Hypothesis not confirmed. == did not make a difference. 3. Hypothesis is confirmed in that the correct value is being captured since according to the documentation .value returns a string, so we know that what is being typed into the box returns a string even if a number were typed. + +4. Hypothesis is confirmed. The userInput == correctAnswer for whatever reason is not evaluating to true, even if I literally type in "a." However, if I set the if statement to true, it will always return the correct message. So the problem lie in the if statement. ```
From 0fd7d3ab0f7a24f0a5471a37215f9d4ba9ea1a47 Mon Sep 17 00:00:00 2001 From: Barry Lew <36746836+grendel108@users.noreply.github.com> Date: Sun, 11 Mar 2018 21:42:24 -0700 Subject: [PATCH 10/14] Update README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index eaac33e..27ca5ca 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,14 @@ Your conclusion here... 3. Hypothesis is confirmed in that the correct value is being captured since according to the documentation .value returns a string, so we know that what is being typed into the box returns a string even if a number were typed. 4. Hypothesis is confirmed. The userInput == correctAnswer for whatever reason is not evaluating to true, even if I literally type in "a." However, if I set the if statement to true, it will always return the correct message. So the problem lie in the if statement. + +According to: +https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators + +var object1 = {'key': 'value'}, object2 = {'key': 'value'}; +object1 == object2 //false + +So comparing two variables will always result in false????? ```
From acd6e4f55eab7de363bff028f5faf7e82504131e Mon Sep 17 00:00:00 2001 From: Barry Lew <36746836+grendel108@users.noreply.github.com> Date: Sun, 11 Mar 2018 21:47:32 -0700 Subject: [PATCH 11/14] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 27ca5ca..aa56377 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comp var object1 = {'key': 'value'}, object2 = {'key': 'value'}; object1 == object2 //false -So comparing two variables will always result in false????? +So comparing two variables will always result in false????? Because String objects are being compared. ```
From 0766ceefe936f8bfb5009f76a1b47f27d9716a3c Mon Sep 17 00:00:00 2001 From: Barry Lew <36746836+grendel108@users.noreply.github.com> Date: Mon, 12 Mar 2018 10:15:39 -0700 Subject: [PATCH 12/14] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index aa56377..b8eae48 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,8 @@ Your results here... 3. It's still displaying the wrong message. +4. "You're correct" will display no matter what I type. + ```
From f4493cebb3ba276ac9f8a069259e870db8b813d4 Mon Sep 17 00:00:00 2001 From: Barry Lew <36746836+grendel108@users.noreply.github.com> Date: Mon, 12 Mar 2018 10:19:34 -0700 Subject: [PATCH 13/14] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b8eae48..5dc46b7 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,7 @@ var object1 = {'key': 'value'}, object2 = {'key': 'value'}; object1 == object2 //false So comparing two variables will always result in false????? Because String objects are being compared. + ```
From dd4eb312ff87aa912e75562db54d674740112922 Mon Sep 17 00:00:00 2001 From: Barry Lew <36746836+grendel108@users.noreply.github.com> Date: Fri, 16 Mar 2018 21:04:02 -0700 Subject: [PATCH 14/14] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 5dc46b7..f4e5092 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Your answer here... 2. The strict === vs. lazy == equal sign may not be comparing our answer correctly with the assigned value. 3. Line 8: The value that the user typed in might not be captured properly. 4. Line 8 is not evaluating to True. +5. Assignment of value from user-input is being done BEFORE user input occurs. ``` @@ -45,6 +46,8 @@ Your list of questions here.... 3. What "value" is being captured on Line 8? The value that the user entered or the value of the id? After identifying the id of the user input element, is "value" the correct way to get the value of what the user entered? 4. What if I set Line 26 to true? + +5. What if I move userInput assignment into the function compareAndDisplayOutcome? ```
@@ -99,6 +102,8 @@ Your list of steps to run your experiment... 3. Even changing Line 26 to a literal answer of "a" without a variable doesn't result in the correct message. 4. Setting Line 26 to true will always result in correct answer, no matter what I type. + +5. ```
@@ -121,6 +126,8 @@ Your results here... 4. "You're correct" will display no matter what I type. +5. Inputting the correct answer "a" results in the correct answer. + ```
@@ -151,6 +158,8 @@ object1 == object2 //false So comparing two variables will always result in false????? Because String objects are being compared. +5. When something happens is important. Also, the initial assignment was global, whereas it should have been local to the function. Assigning a value to userInput before user input occurs means that a null value was being assigned. Anything compared to null would result in a false condition. Hence, the game never results in a correct answer. + ```