From aae11f3480322b4044e5fbed7a77f85e72013cef Mon Sep 17 00:00:00 2001 From: Wally Jniyah Date: Wed, 7 Sep 2016 12:19:32 -0700 Subject: [PATCH 1/2] answered the challanges Updated --- Challenges/Week2/README.md | 1 + Challenges/Week2/app.js | 26 ++++ Challenges/Week2/index.html | 2 +- Challenges/Week2/index.sublime-workspace | 164 +++++++++++++++++++++++ 4 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 Challenges/Week2/index.sublime-workspace diff --git a/Challenges/Week2/README.md b/Challenges/Week2/README.md index 85d98e0..885f1f0 100644 --- a/Challenges/Week2/README.md +++ b/Challenges/Week2/README.md @@ -1,5 +1,6 @@ Try and do all of the following. Don't worry if you can't complete everything or have difficulty getting started. We'll walk through this in class next week! + -Prompt the user for input and store that into a variable -Pass that value into a function diff --git a/Challenges/Week2/app.js b/Challenges/Week2/app.js index 146acc5..6279f3b 100644 --- a/Challenges/Week2/app.js +++ b/Challenges/Week2/app.js @@ -6,3 +6,29 @@ //Call function //Alert user results + +/* -Prompt the user for input and store that into a variable + +-Pass that value into a function + +-If the user entered 'Hello' into the prompt, alert the user with 'Hello World!' + +-If they entered anything else, alert with a different message of your choice (such as "Incorrect input!" + +-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! +*/ + + + + + function input() { + var sayHello = prompt(); + if (sayHello === 'Hello') { + alert('Hello World'); + } else { + alert("Incorrect input!"); + } + } + + + diff --git a/Challenges/Week2/index.html b/Challenges/Week2/index.html index afe8e37..2f1bae7 100644 --- a/Challenges/Week2/index.html +++ b/Challenges/Week2/index.html @@ -15,6 +15,6 @@

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! - + diff --git a/Challenges/Week2/index.sublime-workspace b/Challenges/Week2/index.sublime-workspace new file mode 100644 index 0000000..b9b9f2d --- /dev/null +++ b/Challenges/Week2/index.sublime-workspace @@ -0,0 +1,164 @@ +{ + "auto_complete": + { + "selected_items": + [ + ] + }, + "buffers": + [ + ], + "build_system": "", + "build_system_choices": + [ + ], + "build_varint": "", + "command_palette": + { + "height": 392.0, + "last_filter": "", + "selected_items": + [ + ], + "width": 416.0 + }, + "console": + { + "height": 0.0, + "history": + [ + ] + }, + "distraction_free": + { + "menu_visible": true, + "show_minimap": false, + "show_open_files": false, + "show_tabs": false, + "side_bar_visible": false, + "status_bar_visible": false + }, + "file_history": + [ + ], + "find": + { + "height": 0.0 + }, + "find_in_files": + { + "height": 0.0, + "where_history": + [ + ] + }, + "find_state": + { + "case_sensitive": false, + "find_history": + [ + ], + "highlight": true, + "in_selection": false, + "preserve_case": false, + "regex": false, + "replace_history": + [ + ], + "reverse": false, + "show_context": true, + "use_buffer2": true, + "whole_word": false, + "wrap": true + }, + "groups": + [ + { + "sheets": + [ + ] + } + ], + "incremental_find": + { + "height": 0.0 + }, + "input": + { + "height": 0.0 + }, + "layout": + { + "cells": + [ + [ + 0, + 0, + 1, + 1 + ] + ], + "cols": + [ + 0.0, + 1.0 + ], + "rows": + [ + 0.0, + 1.0 + ] + }, + "menu_visible": true, + "output.find_results": + { + "height": 0.0 + }, + "pinned_build_system": "", + "project": "index.sublime-project", + "replace": + { + "height": 0.0 + }, + "save_all_on_build": true, + "select_file": + { + "height": 0.0, + "last_filter": "", + "selected_items": + [ + ], + "width": 0.0 + }, + "select_project": + { + "height": 0.0, + "last_filter": "", + "selected_items": + [ + ], + "width": 0.0 + }, + "select_symbol": + { + "height": 0.0, + "last_filter": "", + "selected_items": + [ + ], + "width": 0.0 + }, + "selected_group": 0, + "settings": + { + }, + "show_minimap": true, + "show_open_files": false, + "show_tabs": true, + "side_bar_visible": true, + "side_bar_width": 150.0, + "status_bar_visible": true, + "template_settings": + { + } +} From 0187c070b497bf06b6c0db1a8b4e712d6b385371 Mon Sep 17 00:00:00 2001 From: Wally Jniyah Date: Wed, 7 Sep 2016 16:00:30 -0400 Subject: [PATCH 2/2] Answered the Challenges Updated 1.1 --- Challenges/Week2/app.js | 19 +-- Challenges/Week2/index.sublime-workspace | 164 ----------------------- 2 files changed, 7 insertions(+), 176 deletions(-) delete mode 100644 Challenges/Week2/index.sublime-workspace diff --git a/Challenges/Week2/app.js b/Challenges/Week2/app.js index 6279f3b..4522d9f 100644 --- a/Challenges/Week2/app.js +++ b/Challenges/Week2/app.js @@ -18,17 +18,12 @@ -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! */ - - - - function input() { - var sayHello = prompt(); +function hello() { + var sayHello = prompt(); if (sayHello === 'Hello') { - alert('Hello World'); + alert('Hello World'); } else { - alert("Incorrect input!"); - } - } - - - + alert("Incorrect input!"); + } +} +hello(); diff --git a/Challenges/Week2/index.sublime-workspace b/Challenges/Week2/index.sublime-workspace deleted file mode 100644 index b9b9f2d..0000000 --- a/Challenges/Week2/index.sublime-workspace +++ /dev/null @@ -1,164 +0,0 @@ -{ - "auto_complete": - { - "selected_items": - [ - ] - }, - "buffers": - [ - ], - "build_system": "", - "build_system_choices": - [ - ], - "build_varint": "", - "command_palette": - { - "height": 392.0, - "last_filter": "", - "selected_items": - [ - ], - "width": 416.0 - }, - "console": - { - "height": 0.0, - "history": - [ - ] - }, - "distraction_free": - { - "menu_visible": true, - "show_minimap": false, - "show_open_files": false, - "show_tabs": false, - "side_bar_visible": false, - "status_bar_visible": false - }, - "file_history": - [ - ], - "find": - { - "height": 0.0 - }, - "find_in_files": - { - "height": 0.0, - "where_history": - [ - ] - }, - "find_state": - { - "case_sensitive": false, - "find_history": - [ - ], - "highlight": true, - "in_selection": false, - "preserve_case": false, - "regex": false, - "replace_history": - [ - ], - "reverse": false, - "show_context": true, - "use_buffer2": true, - "whole_word": false, - "wrap": true - }, - "groups": - [ - { - "sheets": - [ - ] - } - ], - "incremental_find": - { - "height": 0.0 - }, - "input": - { - "height": 0.0 - }, - "layout": - { - "cells": - [ - [ - 0, - 0, - 1, - 1 - ] - ], - "cols": - [ - 0.0, - 1.0 - ], - "rows": - [ - 0.0, - 1.0 - ] - }, - "menu_visible": true, - "output.find_results": - { - "height": 0.0 - }, - "pinned_build_system": "", - "project": "index.sublime-project", - "replace": - { - "height": 0.0 - }, - "save_all_on_build": true, - "select_file": - { - "height": 0.0, - "last_filter": "", - "selected_items": - [ - ], - "width": 0.0 - }, - "select_project": - { - "height": 0.0, - "last_filter": "", - "selected_items": - [ - ], - "width": 0.0 - }, - "select_symbol": - { - "height": 0.0, - "last_filter": "", - "selected_items": - [ - ], - "width": 0.0 - }, - "selected_group": 0, - "settings": - { - }, - "show_minimap": true, - "show_open_files": false, - "show_tabs": true, - "side_bar_visible": true, - "side_bar_width": 150.0, - "status_bar_visible": true, - "template_settings": - { - } -}