From 9c415718f4870e4f93d64a9b3de7c54a6238bc4a Mon Sep 17 00:00:00 2001 From: Kim Weast Date: Mon, 2 Oct 2023 07:18:36 -0500 Subject: [PATCH 1/5] update JavaScript_Variables --- app.js | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 142 insertions(+), 6 deletions(-) diff --git a/app.js b/app.js index c5fc982..ff8f7ca 100644 --- a/app.js +++ b/app.js @@ -1,10 +1,146 @@ -console.log("Hello World!\n==========\n"); -console.log( + "Follow the steps in the README.md file to complete the exercises:\n==========\n" -); -// Exercise 1 -// Exercise 2 -// Exercise 3 +//Excercise 1 +for(let i = 1; i <= 100 ;i++) +if( i % 3 ==0 ); +for (let index = 0; index < array.length; index++) { + const element = array[index]; + console.log("FIZZ") +} + +//Exercise 2 +// If the number is divisable by 3 +if (i % 3 == 0) { + console.log("FIZZ"); +} +//If the number is divisable by 5 +if (i % 5 == 0) { + console.log("Buzz"); +} +//Otherwise +if(i % 5 == 0 && i % 3 == 0) { + for (let index = 0; index < array.length; index++) { + const element = array[index]; + console.log("FIZZBUZZ"); +} +while (x > 3) { + console.log("hello"); +} + do { + console.log("Hello"); + } while (x > 3); { + + } + //Intializtion + let i =0; + //Condition + while(i <= 100) { + //If i is odd + if (i % 2 == 1) + //Print i on the console + i++; + console.log(i); + + } +//Increment +i++; +} +i = 0; +do{ + if (i % 2 == 1) { + console.log(i, "do while"); + } + i++; +} while (i <= 100); +//If the number is divisable by 3 and 5 +if (i % 5 == 0 && i % 3 ==0) { + //then print FIZZBUZZ + +} +//if the number is divisable by 3 +if (i % 3 == 0) { + console.log("FIZZ") +} +//If the number is divisable by 5 +if ( i % 5 ==0); +console.log("BUZZ"); +//Repeating the Fizzbuss with While/Do-While +while(i <= 100) { + //If i is odd + if (i % 3 == 0) + //Print i on the console + i++; + console.log(i); + + } +//Increment +i++; +}while (i<= 100 ); + +do{ + if (i % 2 == 1) { + console.log(i, "do while"); + } + i++; +} while (i <= 100); +//Exercise 4 find value +//create a random numebr between 0 and 500 +let value = Math.round(Math.random() *( 500 - 100) ); + +//create a random number between 100 and 500 +let n = (math.round() * (500- 100) + 100); +//I need a variable to help me remember +let FoundValue = false; + + +for(let j = 0; j <= n; j++){ + if( j == value) + didFindValue = true; + console.log("Found value!"); + //end the loop before its natural or expected end + } + break; +//true/false +if (!didFindValue) { +console.log("Did not find value"); + +} +//Exercise 5 + + +//create a random between 1 and 10 +let fizzDivor = Math.round(Math.random() * (1-10) + 1) +//creatw a random number between 1 and 10 + + + + + + + +for (let j = start; j <= end); j++ { + //check if its divisible by both numbers + if(j % fizzDivisor == 0 && j % bussDividor == 0){ + console.log("FIZZBUZZ"); + + } + //Otherwise, it was not a divisable by both + else{ + //check it it es divisable by at least one of em + + if (j % fizzDivisor == 0){ + console.log("FIZZ"); + } + if (j % buzzDivisor == 0){ + console.log("BUZZ") + } + + +} +console.log("Divisors:", fizzDivor, buzzDivisor); +console.log("start/end", start, end); + + From aeba142bfaeffeef6ed6eb7f1bcea3fea6ff73f2 Mon Sep 17 00:00:00 2001 From: Kim Weast Date: Mon, 2 Oct 2023 08:17:03 -0500 Subject: [PATCH 2/5] JavaScript_Variables --- JavaScript_Variables | 1 + 1 file changed, 1 insertion(+) create mode 160000 JavaScript_Variables diff --git a/JavaScript_Variables b/JavaScript_Variables new file mode 160000 index 0000000..e36036e --- /dev/null +++ b/JavaScript_Variables @@ -0,0 +1 @@ +Subproject commit e36036e07f564aff9a734672a9ba7edf8bbbd379 From f813f333f59d6a119d814c7ce2c54a86073f2df2 Mon Sep 17 00:00:00 2001 From: Kim Weast Date: Tue, 10 Oct 2023 10:45:01 -0500 Subject: [PATCH 3/5] JavaScript_Variables --- .vscode/settings.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..6f3a291 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file From af63ed30b842afd53b63ee77401bb529fe1ca9fa Mon Sep 17 00:00:00 2001 From: kkwweast <142822197+kkwweast@users.noreply.github.com> Date: Thu, 12 Oct 2023 06:05:25 -0500 Subject: [PATCH 4/5] Variables --- README.md | 110 ++++++++++++++++++------------------- app.js | 156 ++++------------------------------------------------- index.html | 42 +++++++-------- style.css | 65 ++++++++++++++++++++++ 4 files changed, 151 insertions(+), 222 deletions(-) create mode 100644 style.css diff --git a/README.md b/README.md index d222c0c..8097a3c 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,55 @@ ---- -title: "Exercise: JS Introduction and Variables" -slug: "/js-introduction-and-variables-exercise" ---- - -## Objective - -Your objective is to begin using variables to store and pass values throughout your program. - -> To see your work, you can _log_, or print, the values stored in your variables to the _console_. Use `console.log(variableName)` to see your results in the browser console. - -## Exercise 1: Declaring Variables - -Steps are to be completed in the `app.js` file. - -1. Declare a variable named `firstName` using the `const` keyword -2. Declare a variable named `lastName` using the `let` keyword -3. Declare a variable named `age` using the `var` keyword - -## Exercise 2: Assigning Values to Variables - -Steps are to be completed in the `app.js` file. - -1. Assign your first name as the **string** value to the variable `firstName` -2. Assign your last name as the **string** value to the variable `lastName` -3. Assign your age as the **number** value to the variable `age` - -## Exercise 3: Declaring and Assigning Values to Variables - -Steps are to be completed in the `app.js` file. - -1. Declare a variable named `language` using the `let` keyword, and assign it the value `"JavaScript"` (string) -2. Declare a variable named `createdYear` using the `let` keyword, and assign it the value `1995` (number) -3. Declare a variable named `isCaseSensitive` using the `let` keyword, and assign it the value `true` (boolean) - -## Exercise 4: Declaring and Assigning Values to Variables x2 - -Steps are to be completed in the `app.js` file. - -1. Declare a variable named `price` using the `let` keyword, and assign it the value `19.99` (number) -2. Declare a variable named `isOnSale` using the `let` keyword, and assign it the value `false` (boolean) -3. Declare a variable named `salePercentage` using the `let` keyword, and assign it the value `15` (number) -4. Declare a variable named `stock` using the `let` keyword, and assign it the value `0` (number) -5. Declare a variable named `inStock` using the `let` keyword, and assign it the value `false` (boolean) -6. Declare a variable named `selectedSize` using the `let` keyword, and assign it the value `"M"` (string) - -## Exercise 5: Declaring and Assigning Values to Variables x3 - -Steps are to be completed in the `app.js` file. - -1. Declare a variable named `title` using the `let` keyword, and assign it the value `"Name of the Wind"` (string) -2. Declare a variable named `author` using the `let` keyword, and assign it the value `"Patrick Rothfuss"` (string) -3. Declare a variable named `pageCount` using the `let` keyword, and assign it the value `722` (number) -4. Declare a variable named `bookmark` using the `let` keyword, and assign it the value `456` (number) -5. Declare a variable named `hasRead` using the `let` keyword, and assign it the value `true` (boolean) +--- +title: "Exercise: JS Introduction and Variables" +slug: "/js-introduction-and-variables-exercise" +--- + +## Objective + +Your objective is to begin using variables to store and pass values throughout your program. + +> To see your work, you can _log_, or print, the values stored in your variables to the _console_. Use `console.log(variableName)` to see your results in the browser console. + +## Exercise 1: Declaring Variables + +Steps are to be completed in the `app.js` file. + +1. Declare a variable named `firstName` using the `const` keyword +2. Declare a variable named `lastName` using the `let` keyword +3. Declare a variable named `age` using the `var` keyword + +## Exercise 2: Assigning Values to Variables + +Steps are to be completed in the `app.js` file. + +1. Assign your first name as the **string** value to the variable `firstName` +2. Assign your last name as the **string** value to the variable `lastName` +3. Assign your age as the **number** value to the variable `age` + +## Exercise 3: Declaring and Assigning Values to Variables + +Steps are to be completed in the `app.js` file. + +1. Declare a variable named `language` using the `let` keyword, and assign it the value `"JavaScript"` (string) +2. Declare a variable named `createdYear` using the `let` keyword, and assign it the value `1995` (number) +3. Declare a variable named `isCaseSensitive` using the `let` keyword, and assign it the value `true` (boolean) + +## Exercise 4: Declaring and Assigning Values to Variables x2 + +Steps are to be completed in the `app.js` file. + +1. Declare a variable named `price` using the `let` keyword, and assign it the value `19.99` (number) +2. Declare a variable named `isOnSale` using the `let` keyword, and assign it the value `false` (boolean) +3. Declare a variable named `salePercentage` using the `let` keyword, and assign it the value `15` (number) +4. Declare a variable named `stock` using the `let` keyword, and assign it the value `0` (number) +5. Declare a variable named `inStock` using the `let` keyword, and assign it the value `false` (boolean) +6. Declare a variable named `selectedSize` using the `let` keyword, and assign it the value `"M"` (string) + +## Exercise 5: Declaring and Assigning Values to Variables x3 + +Steps are to be completed in the `app.js` file. + +1. Declare a variable named `title` using the `let` keyword, and assign it the value `"Name of the Wind"` (string) +2. Declare a variable named `author` using the `let` keyword, and assign it the value `"Patrick Rothfuss"` (string) +3. Declare a variable named `pageCount` using the `let` keyword, and assign it the value `722` (number) +4. Declare a variable named `bookmark` using the `let` keyword, and assign it the value `456` (number) +5. Declare a variable named `hasRead` using the `let` keyword, and assign it the value `true` (boolean) diff --git a/app.js b/app.js index ff8f7ca..26fdde2 100644 --- a/app.js +++ b/app.js @@ -1,146 +1,10 @@ - - "Follow the steps in the README.md file to complete the exercises:\n==========\n" - - - -//Excercise 1 -for(let i = 1; i <= 100 ;i++) -if( i % 3 ==0 ); -for (let index = 0; index < array.length; index++) { - const element = array[index]; - console.log("FIZZ") -} - -//Exercise 2 -// If the number is divisable by 3 -if (i % 3 == 0) { - console.log("FIZZ"); -} -//If the number is divisable by 5 -if (i % 5 == 0) { - console.log("Buzz"); -} -//Otherwise -if(i % 5 == 0 && i % 3 == 0) { - for (let index = 0; index < array.length; index++) { - const element = array[index]; - console.log("FIZZBUZZ"); -} -while (x > 3) { - console.log("hello"); -} - do { - console.log("Hello"); - } while (x > 3); { - - } - //Intializtion - let i =0; - //Condition - while(i <= 100) { - //If i is odd - if (i % 2 == 1) - //Print i on the console - i++; - console.log(i); - - } -//Increment -i++; -} -i = 0; -do{ - if (i % 2 == 1) { - console.log(i, "do while"); - } - i++; -} while (i <= 100); -//If the number is divisable by 3 and 5 -if (i % 5 == 0 && i % 3 ==0) { - //then print FIZZBUZZ - -} -//if the number is divisable by 3 -if (i % 3 == 0) { - console.log("FIZZ") -} -//If the number is divisable by 5 -if ( i % 5 ==0); -console.log("BUZZ"); -//Repeating the Fizzbuss with While/Do-While -while(i <= 100) { - //If i is odd - if (i % 3 == 0) - //Print i on the console - i++; - console.log(i); - - } -//Increment -i++; -}while (i<= 100 ); - -do{ - if (i % 2 == 1) { - console.log(i, "do while"); - } - i++; -} while (i <= 100); -//Exercise 4 find value -//create a random numebr between 0 and 500 -let value = Math.round(Math.random() *( 500 - 100) ); - -//create a random number between 100 and 500 -let n = (math.round() * (500- 100) + 100); -//I need a variable to help me remember -let FoundValue = false; - - -for(let j = 0; j <= n; j++){ - if( j == value) - didFindValue = true; - console.log("Found value!"); - //end the loop before its natural or expected end - } - break; -//true/false -if (!didFindValue) { -console.log("Did not find value"); - -} -//Exercise 5 - - -//create a random between 1 and 10 -let fizzDivor = Math.round(Math.random() * (1-10) + 1) -//creatw a random number between 1 and 10 - - - - - - - -for (let j = start; j <= end); j++ { - //check if its divisible by both numbers - if(j % fizzDivisor == 0 && j % bussDividor == 0){ - console.log("FIZZBUZZ"); - - } - //Otherwise, it was not a divisable by both - else{ - //check it it es divisable by at least one of em - - if (j % fizzDivisor == 0){ - console.log("FIZZ"); - } - if (j % buzzDivisor == 0){ - console.log("BUZZ") - } - - -} -console.log("Divisors:", fizzDivor, buzzDivisor); -console.log("start/end", start, end); - - +console.log("Hello World!\n==========\n"); +console.log( + "Follow the steps in the README.md file to complete the exercises:\n==========\n" +); + +// Exercise 1 + +// Exercise 2 + +// Exercise 3 diff --git a/index.html b/index.html index 5e6a97f..19a3053 100644 --- a/index.html +++ b/index.html @@ -1,21 +1,21 @@ - - - - - - JavaScript Variables - - -
-
-

Exercises: JavaScript Variables

-
    -
  • Declaring Variables
  • -
  • Working with Strings
  • -
  • Primitive Type Practice
  • -
-
-
- - - + + + + + + JavaScript Variables + + +
+
+

Exercises: JavaScript Variables

+
    +
  • Declaring Variables
  • +
  • Working with Strings
  • +
  • Primitive Type Practice
  • +
+
+
+ + + diff --git a/style.css b/style.css new file mode 100644 index 0000000..20f6ea8 --- /dev/null +++ b/style.css @@ -0,0 +1,65 @@ + + +@keyframes glow { + 0% { + text-shadow: 0 0 10px rgba(10, 55, 15, 0.7); + } + 50% { + text-shadow: 0 0 20px rgba(255, 255, 255, 0.9); + } + 100% { + text-shadow: 0 0 10px rgba(255, 255, 255, 0.7); + } + } + + #glowText { + + animation: glow 2s infinite; + } + + +#glowText { + font-size: 36px; + text-align: center; + color: #fff; + text-shadow: 0 0 10px rgba(255, 255, 255, 0.7); + } + + + + + + + + + +div { + background-color: rgb(170, 118, 219); + } + + + p { + background-color: #f4b5e6; + } + + button { + background-color: hsl(294, 93%, 48%); + } + +body { + background-color: rgb(149, 86, 132); + font-family: Arial,Impact, 'Arial Narrow Bold', sans-serif ; + } + + h1 { + color: rgb(2, 2, 42); + } + +#myButton { + background-color: #40045d; + color: #fff; + padding: 10px 20px; + border: none; + cursor: pointer; + } + \ No newline at end of file From c00d590e5c953d3b6c7451fe56dee9ff78d2ac26 Mon Sep 17 00:00:00 2001 From: kkwweast <142822197+kkwweast@users.noreply.github.com> Date: Thu, 12 Oct 2023 07:26:07 -0500 Subject: [PATCH 5/5] update variable to kkwweast-patch-1 --- app.js | 40 +++++++++++++++++++++++++++++++++------- index.html | 12 +++++++++++- style.css | 3 +-- 3 files changed, 45 insertions(+), 10 deletions(-) diff --git a/app.js b/app.js index 26fdde2..2587fcd 100644 --- a/app.js +++ b/app.js @@ -1,10 +1,36 @@ -console.log("Hello World!\n==========\n"); -console.log( - "Follow the steps in the README.md file to complete the exercises:\n==========\n" -); -// Exercise 1 +"Follow the steps in the README.md file to complete the exercises:\n==========\n" -// Exercise 2 -// Exercise 3 + +//Excercise 1 +const firstName = "Rosie"; +let lastName = "Cotton"; +var age = 15; + +let language = "JavaScript"; +let createdYear = 1995; +let isCaseSensitive = "true"; + +console.log(`${language} was first release in ${createdYear}.`); + +let product = "T-shirty" +Let price = 19.99; +let isOnSale = false; +let salePercentage = 15; +let inStock = false; +let selectSize = "M"; + + + + + +} + +Let title = "Name of the Wind"; +Let author = Patrick Rothfuss; +Let pageCount = 722; +let bookMark = 456; +let hasRead = true; + +console.log ('${title} by ${author} is ${pageCount} pages long.`) diff --git a/index.html b/index.html index 19a3053..342f81a 100644 --- a/index.html +++ b/index.html @@ -1,11 +1,15 @@ + + JavaScript Variables +

JS:Intro and Variables

+

Exercises: JavaScript Variables

@@ -16,6 +20,12 @@

Exercises: JavaScript Variables

+ + - + \ No newline at end of file diff --git a/style.css b/style.css index 20f6ea8..9b47223 100644 --- a/style.css +++ b/style.css @@ -61,5 +61,4 @@ body { padding: 10px 20px; border: none; cursor: pointer; - } - \ No newline at end of file + } \ No newline at end of file