From 598dae846567babe6ee5e9b34f01460094046f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98Brittany?= Date: Thu, 21 Jun 2018 19:11:23 -0400 Subject: [PATCH 01/11] adding html, css, and javascript code --- lab-01/index.html | 14 ++++++++++++++ lab-01/main.css | 0 lab-01/main.js | 4 ++++ 3 files changed, 18 insertions(+) create mode 100644 lab-01/index.html create mode 100644 lab-01/main.css create mode 100644 lab-01/main.js diff --git a/lab-01/index.html b/lab-01/index.html new file mode 100644 index 0000000..2f318ca --- /dev/null +++ b/lab-01/index.html @@ -0,0 +1,14 @@ + + + + + + Hello World + + + + + +

Hello again!

+ + \ No newline at end of file diff --git a/lab-01/main.css b/lab-01/main.css new file mode 100644 index 0000000..e69de29 diff --git a/lab-01/main.js b/lab-01/main.js new file mode 100644 index 0000000..71f67b9 --- /dev/null +++ b/lab-01/main.js @@ -0,0 +1,4 @@ +alert("Hi!"); +let name = prompt("What's your name?"); +let faveColor = prompt("What's your favorite color?"); +confirm("Hi, "+ name + "! It's nice to meet you. My favorite color is " + faveColor + " too."); \ No newline at end of file From 405f03b1c63da8bf1cfda4c217b1ca36364fae8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98Brittany?= Date: Thu, 21 Jun 2018 19:31:19 -0400 Subject: [PATCH 02/11] trying to publish --- index.html | 14 ++++++++++++++ main.css | 0 main.js | 4 ++++ 3 files changed, 18 insertions(+) create mode 100644 index.html create mode 100644 main.css create mode 100644 main.js diff --git a/index.html b/index.html new file mode 100644 index 0000000..2f318ca --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + + Hello World + + + + + +

Hello again!

+ + \ No newline at end of file diff --git a/main.css b/main.css new file mode 100644 index 0000000..e69de29 diff --git a/main.js b/main.js new file mode 100644 index 0000000..71f67b9 --- /dev/null +++ b/main.js @@ -0,0 +1,4 @@ +alert("Hi!"); +let name = prompt("What's your name?"); +let faveColor = prompt("What's your favorite color?"); +confirm("Hi, "+ name + "! It's nice to meet you. My favorite color is " + faveColor + " too."); \ No newline at end of file From 1d5fe896010ae60644739e606484f25d707e0919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98Brittany?= Date: Thu, 21 Jun 2018 19:38:04 -0400 Subject: [PATCH 03/11] adding third prompt --- .DS_Store | Bin 0 -> 6148 bytes README.md | 1 - index.html | 14 -------------- lab-01/main.js | 5 +++-- main.css | 0 main.js | 4 ---- 6 files changed, 3 insertions(+), 21 deletions(-) create mode 100644 .DS_Store delete mode 100644 README.md delete mode 100644 index.html delete mode 100644 main.css delete mode 100644 main.js diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 - - - - - Hello World - - - - - -

Hello again!

- - \ No newline at end of file diff --git a/lab-01/main.js b/lab-01/main.js index 71f67b9..d43c999 100644 --- a/lab-01/main.js +++ b/lab-01/main.js @@ -1,4 +1,5 @@ alert("Hi!"); let name = prompt("What's your name?"); -let faveColor = prompt("What's your favorite color?"); -confirm("Hi, "+ name + "! It's nice to meet you. My favorite color is " + faveColor + " too."); \ No newline at end of file +let faveColor = prompt("What's your favorite color?"); +let faveAnimal = prompt("What's your favorite animal?"); +confirm("Hi, "+ name + "! It's nice to meet you. My favorite color is " + faveColor + " too. But I'm allergic to " + faveAnimal + "s."); \ No newline at end of file diff --git a/main.css b/main.css deleted file mode 100644 index e69de29..0000000 diff --git a/main.js b/main.js deleted file mode 100644 index 71f67b9..0000000 --- a/main.js +++ /dev/null @@ -1,4 +0,0 @@ -alert("Hi!"); -let name = prompt("What's your name?"); -let faveColor = prompt("What's your favorite color?"); -confirm("Hi, "+ name + "! It's nice to meet you. My favorite color is " + faveColor + " too."); \ No newline at end of file From 095be100dde5229febc07af911994bc13ae64c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98Brittany?= Date: Thu, 21 Jun 2018 19:46:00 -0400 Subject: [PATCH 04/11] added last question --- lab-01/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lab-01/main.js b/lab-01/main.js index d43c999..62df21b 100644 --- a/lab-01/main.js +++ b/lab-01/main.js @@ -2,4 +2,5 @@ alert("Hi!"); let name = prompt("What's your name?"); let faveColor = prompt("What's your favorite color?"); let faveAnimal = prompt("What's your favorite animal?"); -confirm("Hi, "+ name + "! It's nice to meet you. My favorite color is " + faveColor + " too. But I'm allergic to " + faveAnimal + "s."); \ No newline at end of file +let faveBand = prompt("What's your favorite band?"); +confirm("Hi, "+ name + "! It's nice to meet you. My favorite color is " + faveColor + " too. But I'm allergic to " + faveAnimal + "s. Did you hear that " + faveBand + " is in town next week?"); \ No newline at end of file From 7a65216efc4da57f96e953c4bf74d10b54d60f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98Brittany?= Date: Thu, 21 Jun 2018 20:08:22 -0400 Subject: [PATCH 05/11] added four questions to HTML --- lab-01/index.html | 5 ++++- lab-01/main.js | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lab-01/index.html b/lab-01/index.html index 2f318ca..4c87dfa 100644 --- a/lab-01/index.html +++ b/lab-01/index.html @@ -9,6 +9,9 @@ -

Hello again!

+

What's your name?

+

What's your favorite color?

+

What's your favorite animal?

+

What's your favorite band?

\ No newline at end of file diff --git a/lab-01/main.js b/lab-01/main.js index 62df21b..735a32e 100644 --- a/lab-01/main.js +++ b/lab-01/main.js @@ -1,6 +1,10 @@ alert("Hi!"); let name = prompt("What's your name?"); +console.log(name); let faveColor = prompt("What's your favorite color?"); +console.log(prompt); let faveAnimal = prompt("What's your favorite animal?"); +console.log(faveAnimal); let faveBand = prompt("What's your favorite band?"); +console.log(faveBand); confirm("Hi, "+ name + "! It's nice to meet you. My favorite color is " + faveColor + " too. But I'm allergic to " + faveAnimal + "s. Did you hear that " + faveBand + " is in town next week?"); \ No newline at end of file From 5206d8c304af282400cb4baf5560408f5c4882bf Mon Sep 17 00:00:00 2001 From: Brittany Stubbs Date: Thu, 28 Jun 2018 19:13:05 -0400 Subject: [PATCH 06/11] Delete .DS_Store --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Thu, 28 Jun 2018 19:28:50 -0400 Subject: [PATCH 07/11] fixed --- lab-01/index.html | 21 ++++++++++----- lab-01/main.js | 67 ++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 73 insertions(+), 15 deletions(-) diff --git a/lab-01/index.html b/lab-01/index.html index 4c87dfa..7ae23c0 100644 --- a/lab-01/index.html +++ b/lab-01/index.html @@ -3,15 +3,24 @@ - Hello World + About me - -

What's your name?

-

What's your favorite color?

-

What's your favorite animal?

-

What's your favorite band?

+

All About Name

+
    +
  • What's your favorite color? faveColor
  • +
  • What's your favorite animal? faveAnimal
  • +
  • What's your favorite band? faveBand
  • +
+ + What are your top three favorite movies? +
    +
  1. firstMovie
  2. +
  3. secondMovie
  4. +
  5. thirdMovie
  6. +
+ \ No newline at end of file diff --git a/lab-01/main.js b/lab-01/main.js index 735a32e..0115ec7 100644 --- a/lab-01/main.js +++ b/lab-01/main.js @@ -1,10 +1,59 @@ +let captchaArray = ["erFY4", "br9kl", "qwbM7", "DejK8", "CDxz8", "wefk3", "qwkl8", "Pgh2m", "Wfz5m", "Tgh3M"]; +let captcha = captchaArray[Math.floor(Math.random() * captchaArray.length)]; + alert("Hi!"); -let name = prompt("What's your name?"); -console.log(name); -let faveColor = prompt("What's your favorite color?"); -console.log(prompt); -let faveAnimal = prompt("What's your favorite animal?"); -console.log(faveAnimal); -let faveBand = prompt("What's your favorite band?"); -console.log(faveBand); -confirm("Hi, "+ name + "! It's nice to meet you. My favorite color is " + faveColor + " too. But I'm allergic to " + faveAnimal + "s. Did you hear that " + faveBand + " is in town next week?"); \ No newline at end of file +let captchaResponse = prompt("First, let's make sure you're human. Please type the following (case sensitive): " + captcha); + +if (captcha == captchaResponse) +{ + let name = prompt("What's your name?"); + console.log(name); + let faveColor = prompt("What's your favorite color?"); + console.log(prompt); + let faveAnimal = prompt("What's your favorite animal?"); + console.log(faveAnimal); + let faveBand = prompt("What's your favorite band?"); + console.log(faveBand); + confirm("Hi, "+ name + "! It's nice to meet you. My favorite color is " + faveColor + " too. But I'm allergic to " + faveAnimal + "s. Did you hear that " + faveBand + " is in town next week?"); + alert("What are your top three favorite movies?") + let firstMovie = prompt("First favorite movie"); + console.log(firstMovie); + let secondMovie = prompt("Second favorite movie"); + console.log(secondMovie); + let thirdMovie = prompt("Third favorite movie"); + console.log(thirdMovie); + confirm("Oh, I love " + firstMovie + "! But I haven't seen " + secondMovie + " or " + thirdMovie + " though."); + + if(name!=null){ + document.getElementById('name').innerText = name + } + + if(faveColor!=null){ + document.getElementById('faveColor').innerText = faveColor + } + + if(faveAnimal!=null){ + document.getElementById('faveAnimal').innerText = faveAnimal + } + + if(faveBand!=null){ + document.getElementById('faveBand').innerText = faveBand + } + + if(firstMovie!=null){ + document.getElementById('firstMovie').innerText = firstMovie + } + + if(secondMovie!=null){ + document.getElementById('secondMovie').innerText = secondMovie + } + + if(thirdMovie!=null){ + document.getElementById('thirdMovie').innerText = thirdMovie + } +} + +else{ + let err = confirm("Sorry, incorrect response. Please reload the page.") +} + From 7d5162bd20e2d541e528208657a39db9536ecd15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98Brittany?= Date: Sat, 30 Jun 2018 13:13:14 -0400 Subject: [PATCH 08/11] streamline --- lab-01/main.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lab-01/main.js b/lab-01/main.js index 0115ec7..d41dc52 100644 --- a/lab-01/main.js +++ b/lab-01/main.js @@ -24,31 +24,31 @@ if (captcha == captchaResponse) console.log(thirdMovie); confirm("Oh, I love " + firstMovie + "! But I haven't seen " + secondMovie + " or " + thirdMovie + " though."); - if(name!=null){ + if(name){ document.getElementById('name').innerText = name } - if(faveColor!=null){ + if(faveColor){ document.getElementById('faveColor').innerText = faveColor } - if(faveAnimal!=null){ + if(faveAnimal){ document.getElementById('faveAnimal').innerText = faveAnimal } - if(faveBand!=null){ + if(faveBand){ document.getElementById('faveBand').innerText = faveBand } - if(firstMovie!=null){ + if(firstMovie){ document.getElementById('firstMovie').innerText = firstMovie } - if(secondMovie!=null){ + if(secondMovie){ document.getElementById('secondMovie').innerText = secondMovie } - if(thirdMovie!=null){ + if(thirdMovie){ document.getElementById('thirdMovie').innerText = thirdMovie } } From 3b939316b98353beec817e395712a897adadcdd4 Mon Sep 17 00:00:00 2001 From: Harold Wolfinger Date: Sat, 30 Jun 2018 14:45:29 -0400 Subject: [PATCH 09/11] This commit adds comments to each file, including the readme, and also begins wrapping the variables into function in the main.js file. --- lab-01/README.md | 5 +++ lab-01/index.html | 25 ++++++++--- lab-01/main.css | 1 + lab-01/main.js | 109 ++++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 125 insertions(+), 15 deletions(-) diff --git a/lab-01/README.md b/lab-01/README.md index 50861f6..536c03f 100644 --- a/lab-01/README.md +++ b/lab-01/README.md @@ -1,3 +1,8 @@ +# Updated README.md +This is the pair programming challenge from June 30, 2018, in which I served as driver while Brittany was the navigator. We are going to be adding functions to Brittany's code, and move the logic for the individual questions into separate functions, and call those functions to run the game. + +According to the assignment: In its most basic sense, this is pretty simple and straightforward: 'wrap' the logic and variables for a given question with function someFuncNameYouChoose() { at the beginning, and add a closing curly brace } at the end. To make the function execute, just call it afterwards: someFuncNameYouChoose(); After completing this step the game should behave exactly as it did before. a-c-p + # Assignment Overview: Lab 1 - Write a program that accepts user input and, based on that input, displays messages back to the user. diff --git a/lab-01/index.html b/lab-01/index.html index 4c87dfa..be4db77 100644 --- a/lab-01/index.html +++ b/lab-01/index.html @@ -1,17 +1,30 @@ + + + + - Hello World + About me - -

What's your name?

-

What's your favorite color?

-

What's your favorite animal?

-

What's your favorite band?

+

All About Name

+
    +
  • What's your favorite color? faveColor
  • +
  • What's your favorite animal? faveAnimal
  • +
  • What's your favorite band? faveBand
  • +
+ + What are your top three favorite movies? +
    +
  1. firstMovie
  2. +
  3. secondMovie
  4. +
  5. thirdMovie
  6. +
+ \ No newline at end of file diff --git a/lab-01/main.css b/lab-01/main.css index e69de29..b2828f1 100644 --- a/lab-01/main.css +++ b/lab-01/main.css @@ -0,0 +1 @@ +/* Harold is awesome! He is the best collaborator ever! -hw */ \ No newline at end of file diff --git a/lab-01/main.js b/lab-01/main.js index 735a32e..4156781 100644 --- a/lab-01/main.js +++ b/lab-01/main.js @@ -1,10 +1,101 @@ +// This code includes everything uploaded to gh-pages, not what was on the origin branch that was originally cloned -hw + +let captchaArray = ["erFY4", "br9kl", "qwbM7", "DejK8", "CDxz8", "wefk3", "qwkl8", "Pgh2m", "Wfz5m", "Tgh3M"]; +let captcha = captchaArray[Math.floor(Math.random() * captchaArray.length)]; + alert("Hi!"); -let name = prompt("What's your name?"); -console.log(name); -let faveColor = prompt("What's your favorite color?"); -console.log(prompt); -let faveAnimal = prompt("What's your favorite animal?"); -console.log(faveAnimal); -let faveBand = prompt("What's your favorite band?"); -console.log(faveBand); -confirm("Hi, "+ name + "! It's nice to meet you. My favorite color is " + faveColor + " too. But I'm allergic to " + faveAnimal + "s. Did you hear that " + faveBand + " is in town next week?"); \ No newline at end of file +let captchaResponse = prompt("First, let's make sure you're human. Please type the following (case sensitive): " + captcha); + +let nameFunction = function() { + return prompt("What's your name?"); +} + +let colorFunction = function() { + return prompt("What's your favorite color?"); +} + +let animalFunction = function() { + return prompt("What's your favorite animal?"); +} + +let bandFunction = function() { + return prompt("What's your favorite band?"); +} + +if (captcha == captchaResponse) +{ + //Brittany's updated code for NAME that is wrapped in a function + let name = nameFunction() + console.log(name) + + //Brittany's original code (does not include functions) + //let name = prompt("What's your name?"); + //console.log(name); + + //Brittany's updated code for COLOR that is wrapped in a function + let color = colorFunction() + console.log(color) + + //Brittany's original code (does not include functions) + //let faveColor = prompt("What's your favorite color?"); + //console.log(prompt); + + //Brittany's updated code for ANIMAL that is wrapped in a function + let animal = animalFunction() + console.log(animal) + + //Brittany's original code (does not include functions) + //let faveAnimal = prompt("What's your favorite animal?"); + //console.log(faveAnimal); + + //Brittany's updated code for BAND that is wrapped in a function + let band = bandFunction() + console.log(band) + + //Brittany's original code (does not include functions) + //let faveBand = prompt("What's your favorite band?"); + //console.log(faveBand); + + + confirm("Hi, "+ name + "! It's nice to meet you. My favorite color is " + color + " too. But I'm allergic to " + animal + "s. Did you hear that " + band + " is in town next week?"); + alert("What are your top three favorite movies?") + let firstMovie = prompt("First favorite movie"); + console.log(firstMovie); + let secondMovie = prompt("Second favorite movie"); + console.log(secondMovie); + let thirdMovie = prompt("Third favorite movie"); + console.log(thirdMovie); + confirm("Oh, I love " + firstMovie + "! But I haven't seen " + secondMovie + " or " + thirdMovie + " though."); + + if(name){ + document.getElementById('name').innerText = name + } + + if(faveColor){ + document.getElementById('faveColor').innerText = faveColor + } + + if(faveAnimal){ + document.getElementById('faveAnimal').innerText = faveAnimal + } + + if(faveBand){ + document.getElementById('faveBand').innerText = faveBand + } + + if(firstMovie){ + document.getElementById('firstMovie').innerText = firstMovie + } + + if(secondMovie){ + document.getElementById('secondMovie').innerText = secondMovie + } + + if(thirdMovie){ + document.getElementById('thirdMovie').innerText = thirdMovie + } +} + +else{ + let err = confirm("Sorry, incorrect response. Please reload the page.") +} From 617c1c8d3495893cb6461a6b3b4dcafe97e726b0 Mon Sep 17 00:00:00 2001 From: Harold Wolfinger Date: Sat, 30 Jun 2018 14:58:08 -0400 Subject: [PATCH 10/11] This push updates the second set of questions (favorite movies) to wrap them inside functions. --- lab-01/main.js | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/lab-01/main.js b/lab-01/main.js index 4156781..1517c67 100644 --- a/lab-01/main.js +++ b/lab-01/main.js @@ -22,6 +22,18 @@ let bandFunction = function() { return prompt("What's your favorite band?"); } +let movie1Function = function () { + return prompt("First favorite movie"); +} + +let movie2Function = function () { + return prompt("Second favorite movie"); +} + +let movie3Function = function () { + return prompt("Third favorite movie"); +} + if (captcha == captchaResponse) { //Brittany's updated code for NAME that is wrapped in a function @@ -59,12 +71,29 @@ if (captcha == captchaResponse) confirm("Hi, "+ name + "! It's nice to meet you. My favorite color is " + color + " too. But I'm allergic to " + animal + "s. Did you hear that " + band + " is in town next week?"); alert("What are your top three favorite movies?") - let firstMovie = prompt("First favorite movie"); - console.log(firstMovie); - let secondMovie = prompt("Second favorite movie"); - console.log(secondMovie); - let thirdMovie = prompt("Third favorite movie"); - console.log(thirdMovie); + + + // Brittany's updated code for three favorite movies wrapped in three functions + let firstMovie = movie1Function() + console.log(firstMovie) + + let secondMovie = movie2Function() + console.log(secondMovie) + + let thirdMovie = movie3Function() + console.log (thirdMovie) + + // Brittany's original code for her three favorite movie questions (does not include functions) + // let firstMovie = prompt("First favorite movie"); + // console.log(firstMovie); + + // let secondMovie = prompt("Second favorite movie"); + // console.log(secondMovie); + + // let thirdMovie = prompt("Third favorite movie"); + // console.log(thirdMovie); + + confirm("Oh, I love " + firstMovie + "! But I haven't seen " + secondMovie + " or " + thirdMovie + " though."); if(name){ @@ -72,15 +101,15 @@ if (captcha == captchaResponse) } if(faveColor){ - document.getElementById('faveColor').innerText = faveColor + document.getElementById('faveColor').innerText = color } if(faveAnimal){ - document.getElementById('faveAnimal').innerText = faveAnimal + document.getElementById('faveAnimal').innerText = animal } if(faveBand){ - document.getElementById('faveBand').innerText = faveBand + document.getElementById('faveBand').innerText = band } if(firstMovie){ From 374c6e8a4c4f7061235ed7df2d43fc3ddd362694 Mon Sep 17 00:00:00 2001 From: Harold Wolfinger Date: Sat, 30 Jun 2018 16:09:38 -0400 Subject: [PATCH 11/11] BRITTANY's COMPLETELY RANDOMIXED CAPTCHA, it's really really cool. Plus, eliminated the if-else statement at the end of the game since it was unnecessary. --- lab-01/main.js | 71 +++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/lab-01/main.js b/lab-01/main.js index 1517c67..7d12ea6 100644 --- a/lab-01/main.js +++ b/lab-01/main.js @@ -1,10 +1,21 @@ // This code includes everything uploaded to gh-pages, not what was on the origin branch that was originally cloned -hw -let captchaArray = ["erFY4", "br9kl", "qwbM7", "DejK8", "CDxz8", "wefk3", "qwkl8", "Pgh2m", "Wfz5m", "Tgh3M"]; -let captcha = captchaArray[Math.floor(Math.random() * captchaArray.length)]; +let captchaArray = ['A','B','C','D','E','F','G','H','J','K','L','M','N', 'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','m','n','o','p','q','r','s','t','u','v','w','x','y','z','2', '3', '4', '5', '6', '7', '8', '9'] + +let captcha = captchaArray[Math.floor(Math.random() * captchaArray.length)] + captchaArray[Math.floor(Math.random() * captchaArray.length)] + captchaArray[Math.floor(Math.random() * captchaArray.length)] + captchaArray[Math.floor(Math.random() * captchaArray.length)] + captchaArray[Math.floor(Math.random() * captchaArray.length)]+ captchaArray[Math.floor(Math.random() * captchaArray.length)]; + +// let captchaArray = ["erFY4", "br9kl", "qwbM7", "DejK8", "CDxz8", "wefk3", "qwkl8", "Pgh2m", "Wfz5m", "Tgh3M"]; +// let captcha = captchaArray[Math.floor(Math.random() * captchaArray.length)]; alert("Hi!"); + +// Check captcha, if incorrect ask user to try again let captchaResponse = prompt("First, let's make sure you're human. Please type the following (case sensitive): " + captcha); +console.log("Initial ask: " + captchaResponse); +while (captchaResponse != captcha) { + captchaResponse = prompt("Incorrect response. Please try again. Please type the following (case sensitive): " + captcha); + console.log("New user captcha response: " + captchaResponse) +} let nameFunction = function() { return prompt("What's your name?"); @@ -34,8 +45,6 @@ let movie3Function = function () { return prompt("Third favorite movie"); } -if (captcha == captchaResponse) -{ //Brittany's updated code for NAME that is wrapped in a function let name = nameFunction() console.log(name) @@ -70,6 +79,7 @@ if (captcha == captchaResponse) confirm("Hi, "+ name + "! It's nice to meet you. My favorite color is " + color + " too. But I'm allergic to " + animal + "s. Did you hear that " + band + " is in town next week?"); + alert("What are your top three favorite movies?") @@ -96,35 +106,30 @@ if (captcha == captchaResponse) confirm("Oh, I love " + firstMovie + "! But I haven't seen " + secondMovie + " or " + thirdMovie + " though."); - if(name){ - document.getElementById('name').innerText = name - } - - if(faveColor){ - document.getElementById('faveColor').innerText = color - } - - if(faveAnimal){ - document.getElementById('faveAnimal').innerText = animal - } - - if(faveBand){ - document.getElementById('faveBand').innerText = band - } - - if(firstMovie){ - document.getElementById('firstMovie').innerText = firstMovie - } - - if(secondMovie){ - document.getElementById('secondMovie').innerText = secondMovie - } - - if(thirdMovie){ - document.getElementById('thirdMovie').innerText = thirdMovie - } +if(name){ + document.getElementById('name').innerText = name +} + +if(faveColor){ + document.getElementById('faveColor').innerText = color +} + +if(faveAnimal){ + document.getElementById('faveAnimal').innerText = animal } -else{ - let err = confirm("Sorry, incorrect response. Please reload the page.") +if(faveBand){ + document.getElementById('faveBand').innerText = band } + +if(firstMovie){ + document.getElementById('firstMovie').innerText = firstMovie +} + +if(secondMovie){ + document.getElementById('secondMovie').innerText = secondMovie +} + +if(thirdMovie){ + document.getElementById('thirdMovie').innerText = thirdMovie +} \ No newline at end of file