From 01ba84ba8882ec25438b7888d4175e97f255ea05 Mon Sep 17 00:00:00 2001 From: benblucas Date: Thu, 8 Sep 2016 19:47:02 -0400 Subject: [PATCH 1/3] completing week 2 JS challenge --- Challenges/Week2/app.js | 24 ++++++++++++++++++++++++ Challenges/Week2/index.html | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Challenges/Week2/app.js b/Challenges/Week2/app.js index 146acc5..caad08d 100644 --- a/Challenges/Week2/app.js +++ b/Challenges/Week2/app.js @@ -3,6 +3,30 @@ //Prompt user for input and store variable +function processInput(message) +{ + + console.log(message); + + if(message === "Hello!") + { + return("Hello world!"); + + } + else { + return("You didn't say hello :("); + } +} + +var userInput; + +userInput = prompt(); + +var response = processInput(userInput); + + + + //Call function //Alert user results diff --git a/Challenges/Week2/index.html b/Challenges/Week2/index.html index afe8e37..ff72f2d 100644 --- a/Challenges/Week2/index.html +++ b/Challenges/Week2/index.html @@ -15,6 +15,7 @@

My first code challenge!

  • Don't forget to call your script file from this HTML file! I've created the script tags for you, but you have to add something to it! - + + From e21b397d688c246cde583f2d802c57f662ffdb98 Mon Sep 17 00:00:00 2001 From: benblucas Date: Thu, 8 Sep 2016 19:59:41 -0400 Subject: [PATCH 2/3] updating code to reflect coding correction --- Challenges/Week2/app.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Challenges/Week2/app.js b/Challenges/Week2/app.js index caad08d..1aa2f9c 100644 --- a/Challenges/Week2/app.js +++ b/Challenges/Week2/app.js @@ -8,14 +8,13 @@ function processInput(message) console.log(message); - if(message === "Hello!") + if(message == 'Hello!') { - return("Hello world!"); + return('Hello world!'); - } - else { + } else { return("You didn't say hello :("); - } + } } var userInput; @@ -24,7 +23,7 @@ userInput = prompt(); var response = processInput(userInput); - +console.log(response); //Call function From c9af4702f951cfba9817051d584db18ab63adafa Mon Sep 17 00:00:00 2001 From: benblucas Date: Thu, 15 Sep 2016 20:24:26 -0400 Subject: [PATCH 3/3] Pushing Solutions to Week 3 Challenge --- Challenges/Week3/index.html | 6 +++--- Challenges/Week3/js/app.js | 17 +++++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Challenges/Week3/index.html b/Challenges/Week3/index.html index 2ee5d5a..c582601 100644 --- a/Challenges/Week3/index.html +++ b/Challenges/Week3/index.html @@ -42,8 +42,8 @@

    Flash Cards

    - - + + - \ No newline at end of file + diff --git a/Challenges/Week3/js/app.js b/Challenges/Week3/js/app.js index 432dc9b..56765d7 100644 --- a/Challenges/Week3/js/app.js +++ b/Challenges/Week3/js/app.js @@ -1,14 +1,19 @@ -// 1.) Make sure you have a reference to jQuery from a CDN in the index.html file. +// 1.) Make sure you have a reference to jQuery from a CDN in the index.html file. // 2.) Use a jQuery to hide all of the answers to all the questions. -$('.answer') +$('.answer').hide(); -/* 3.) Write code to show the answer when hovering over a flash card, and hide it when the mouse leaves. +/* 3.) Write code to show the answer when hovering over a flash card, and hide it when the mouse leaves. Find the approriate event on the jQuery API page to trigger an action on hover https://api.jquery.com/category/events/ Hint: You can use "this" inside your jQuery function to reference a selected DOM node. */ -$('.flash-card') +$('.flash-card').hover(function() { + $(this).find('.answer').show(); + +}, function(){ + $(this).find('.answer').hide(); +}); /* 4.) Use jQuery to find the button element on the page and have it toggle all of the answers on and off when clicked. Hint: jQuery has a toggle function that can toggle the visibility of a selected DOM node. - Bonus: Change the text of the button using jQuery when you toggle the answers on/off. */ -$() \ No newline at end of file + Bonus: Change the text of the button using jQuery when you toggle the answers on/off. */ +$()