From 7bd5360c7e8acfdeec81ab49869da9dfe5df5dfd Mon Sep 17 00:00:00 2001 From: enmiraze Date: Thu, 12 Jan 2023 12:08:52 +0100 Subject: [PATCH 01/10] Create README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..b363e66 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# JavaScript-Course-by-Clever-Programmer- +This is a full JavaScript course by Clever Programmer From 53f22b680868658d1f9e7f23a93956946e5a8faa Mon Sep 17 00:00:00 2001 From: mirazedewan Date: Thu, 12 Jan 2023 18:07:17 +0100 Subject: [PATCH 02/10] update --- functions/sum/exercise/index.html | 2 +- functions/sum/exercise/script.js | 44 +++++++++---- functions/sum/solution/script.js | 2 +- projects/gd-matrix/index-1.html | 90 +++++++++++++++++++++++++ projects/gd-matrix/index-2.html | 84 +++++++++++++++++++++++ projects/gd-matrix/index-3.html | 106 ++++++++++++++++++++++++++++++ projects/gd-matrix/index-4.html | 100 ++++++++++++++++++++++++++++ yourPlayground.js | 21 ++++++ 8 files changed, 434 insertions(+), 15 deletions(-) create mode 100644 projects/gd-matrix/index-1.html create mode 100644 projects/gd-matrix/index-2.html create mode 100644 projects/gd-matrix/index-3.html create mode 100644 projects/gd-matrix/index-4.html diff --git a/functions/sum/exercise/index.html b/functions/sum/exercise/index.html index 41e979a..80d1d9c 100644 --- a/functions/sum/exercise/index.html +++ b/functions/sum/exercise/index.html @@ -5,7 +5,7 @@ replit - + diff --git a/functions/sum/exercise/script.js b/functions/sum/exercise/script.js index 69d6b48..d9c1823 100644 --- a/functions/sum/exercise/script.js +++ b/functions/sum/exercise/script.js @@ -8,23 +8,41 @@ ES6 Syntax (Arrow function): const add = () => {} */ -function add(){ - //Add function here -} +// function add(a, b){ +// return a + b +// } -function sub(){ - //Subtract function here -} +const add = (a, b) => a + b; -function div(){ - //Divide function here -} +// function sub(a, b){ +// return a - b +// } -function mul(){ - //Multiply function here -} +const sub = (a, b) => a - b; + +// function div(a, b){ +// return a / b +// } + +const div = (a, b) => a / b; + +// function mul(a, b){ +// return a * b +// } + +const mul = (a, b) => a * b; console.log('hello from the SUM exercise') /* TODO: create a function that console logs the result of any of the above operations. -*/ \ No newline at end of file +*/ + +let addResult = add(10, 5); +let subResult = sub(20, 7); +let divResult = div(10, 5); +let mulResult = mul(10, 5); + +console.log(addResult); +console.log(subResult); +console.log(divResult); +console.log(mulResult); \ No newline at end of file diff --git a/functions/sum/solution/script.js b/functions/sum/solution/script.js index 6a567a7..9f9e955 100644 --- a/functions/sum/solution/script.js +++ b/functions/sum/solution/script.js @@ -1 +1 @@ -console.log("Sum solution")) \ No newline at end of file +console.log("Sum solution"); \ No newline at end of file diff --git a/projects/gd-matrix/index-1.html b/projects/gd-matrix/index-1.html new file mode 100644 index 0000000..bad8884 --- /dev/null +++ b/projects/gd-matrix/index-1.html @@ -0,0 +1,90 @@ + + + + Roulette Table + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + diff --git a/projects/gd-matrix/index-2.html b/projects/gd-matrix/index-2.html new file mode 100644 index 0000000..267475d --- /dev/null +++ b/projects/gd-matrix/index-2.html @@ -0,0 +1,84 @@ + + + + + Roulette Table + + + + + + + + + + + + + + +
Spin NumberDozen 1Dozen 2Dozen 3
+
+
+ +
+ + + diff --git a/projects/gd-matrix/index-3.html b/projects/gd-matrix/index-3.html new file mode 100644 index 0000000..451c1b1 --- /dev/null +++ b/projects/gd-matrix/index-3.html @@ -0,0 +1,106 @@ + + + + Roulette Table + + + + + + + + + + + + + + +
+ + + + + + + + + +
Dozen 1Dozen 2Dozen 3
+ + + + \ No newline at end of file diff --git a/projects/gd-matrix/index-4.html b/projects/gd-matrix/index-4.html new file mode 100644 index 0000000..c6db3d1 --- /dev/null +++ b/projects/gd-matrix/index-4.html @@ -0,0 +1,100 @@ + + + + Roulette Table + + + + + + + + + + + + + + +
+ + +
+ + + diff --git a/yourPlayground.js b/yourPlayground.js index e69de29..9d677e8 100644 --- a/yourPlayground.js +++ b/yourPlayground.js @@ -0,0 +1,21 @@ +function sum(a, b) { + return a + b; +} + +function calculateFoodTotal (food, tip){ + const tipPercentage = tip / 100; + const tipAmount = food * tipPercentage; + const total = sum(food, tipAmount); + + return total; +} + +// console.log(calculateFoodTotal(300, 20)); + +// Arrays + + + + + + From a4ae9e872e9fc825a0c75ebdeec8c13f2fff960e Mon Sep 17 00:00:00 2001 From: mirazedewan Date: Mon, 23 Jan 2023 11:00:03 +0100 Subject: [PATCH 03/10] udpate --- projects/gd-matrix/index-5-1.html | 84 +++++++++++++++++++++++ projects/gd-matrix/index-5-2-1.html | 89 +++++++++++++++++++++++++ projects/gd-matrix/index-5-2.html | 89 +++++++++++++++++++++++++ projects/gd-matrix/index-5-3.html | 100 ++++++++++++++++++++++++++++ projects/gd-matrix/index-5.html | 89 +++++++++++++++++++++++++ 5 files changed, 451 insertions(+) create mode 100644 projects/gd-matrix/index-5-1.html create mode 100644 projects/gd-matrix/index-5-2-1.html create mode 100644 projects/gd-matrix/index-5-2.html create mode 100644 projects/gd-matrix/index-5-3.html create mode 100644 projects/gd-matrix/index-5.html diff --git a/projects/gd-matrix/index-5-1.html b/projects/gd-matrix/index-5-1.html new file mode 100644 index 0000000..c302fed --- /dev/null +++ b/projects/gd-matrix/index-5-1.html @@ -0,0 +1,84 @@ + + + + Number Tracker + + + +

Number Tracker

+
+ + + +
+

+ + + + + + + + + + + + + + + + +
1st Dozen2nd Dozen3rd Dozen
000
+ + + + diff --git a/projects/gd-matrix/index-5-2-1.html b/projects/gd-matrix/index-5-2-1.html new file mode 100644 index 0000000..ac9cd8e --- /dev/null +++ b/projects/gd-matrix/index-5-2-1.html @@ -0,0 +1,89 @@ + + + + Number Tracker + + + +

Number Tracker

+
+ + + +
+ + + + + + + + + + + +
1st Dozen2nd Dozen3rd Dozen
+

+ + + diff --git a/projects/gd-matrix/index-5-2.html b/projects/gd-matrix/index-5-2.html new file mode 100644 index 0000000..ac9cd8e --- /dev/null +++ b/projects/gd-matrix/index-5-2.html @@ -0,0 +1,89 @@ + + + + Number Tracker + + + +

Number Tracker

+
+ + + +
+ + + + + + + + + + + +
1st Dozen2nd Dozen3rd Dozen
+

+ + + diff --git a/projects/gd-matrix/index-5-3.html b/projects/gd-matrix/index-5-3.html new file mode 100644 index 0000000..86f431d --- /dev/null +++ b/projects/gd-matrix/index-5-3.html @@ -0,0 +1,100 @@ + + + + + Number Tracker + + + + +

Number Tracker

+
+ + + +
+ + + + + + + + + + + + + + + +
1st Dozen2nd Dozen3rd Dozen
000
+

+ + + + + \ No newline at end of file diff --git a/projects/gd-matrix/index-5.html b/projects/gd-matrix/index-5.html new file mode 100644 index 0000000..d8859d2 --- /dev/null +++ b/projects/gd-matrix/index-5.html @@ -0,0 +1,89 @@ + + + + Number Tracker + + + +

Number Tracker

+
+ + + +
+ + + + + + + + + + + +
1st Dozen2nd Dozen3rd Dozen
+

+ + + + From 8fae3e3f120933fc29c59e920157251de6c33168 Mon Sep 17 00:00:00 2001 From: mirazedewan Date: Tue, 24 Jan 2023 18:30:01 +0100 Subject: [PATCH 04/10] update --- projects/gd-matrix/index.html | 39 +++++++++++++ projects/gd-matrix/main.js | 56 +++++++++++++++++++ .../gd-matrix/{ => resources}/index-1.html | 0 .../gd-matrix/{ => resources}/index-2.html | 0 .../gd-matrix/{ => resources}/index-3.html | 0 .../gd-matrix/{ => resources}/index-4.html | 0 .../gd-matrix/{ => resources}/index-5-1.html | 0 .../{ => resources}/index-5-2-1.html | 0 .../gd-matrix/{ => resources}/index-5-2.html | 0 .../gd-matrix/{ => resources}/index-5-3.html | 2 +- .../gd-matrix/{ => resources}/index-5.html | 0 projects/gd-matrix/style.css | 55 ++++++++++++++++++ 12 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 projects/gd-matrix/index.html create mode 100644 projects/gd-matrix/main.js rename projects/gd-matrix/{ => resources}/index-1.html (100%) rename projects/gd-matrix/{ => resources}/index-2.html (100%) rename projects/gd-matrix/{ => resources}/index-3.html (100%) rename projects/gd-matrix/{ => resources}/index-4.html (100%) rename projects/gd-matrix/{ => resources}/index-5-1.html (100%) rename projects/gd-matrix/{ => resources}/index-5-2-1.html (100%) rename projects/gd-matrix/{ => resources}/index-5-2.html (100%) rename projects/gd-matrix/{ => resources}/index-5-3.html (98%) rename projects/gd-matrix/{ => resources}/index-5.html (100%) create mode 100644 projects/gd-matrix/style.css diff --git a/projects/gd-matrix/index.html b/projects/gd-matrix/index.html new file mode 100644 index 0000000..58782f3 --- /dev/null +++ b/projects/gd-matrix/index.html @@ -0,0 +1,39 @@ + + + + + Tracker + + + + +

Tracker

+
+ + + +
+

+ + + + + + + + + + + + + + + +
1st Dozen2nd Dozen3rd Dozen
000
+ + + + + + + \ No newline at end of file diff --git a/projects/gd-matrix/main.js b/projects/gd-matrix/main.js new file mode 100644 index 0000000..ecfeb1b --- /dev/null +++ b/projects/gd-matrix/main.js @@ -0,0 +1,56 @@ + + +let addedNumbers = []; // array to store added numbers +let spins = 0; +let input = document.getElementById("number-input"); +let number = input.value; + +function addNumber() { + if (!number) { + alert("Please enter a number between 1 and 36."); + return; + } + addedNumbers.unshift(number); // add number to the beginning of the array + input.value = ""; + updateAddedNumbers(); + var dozen1Count = document.getElementById("dozen1-count"); + var dozen2Count = document.getElementById("dozen2-count"); + var dozen3Count = document.getElementById("dozen3-count"); + if (number <= 12 && number >= 1) { + dozen1Count.innerHTML++; + } else if (number <= 24 && number >= 12) { + dozen2Count.innerHTML++; + } else { + dozen3Count.innerHTML++; + } + spins++; + if (spins === 3) { + spins = 0; + var table = document.getElementById("number-table"); + var row = table.insertRow(); + var dozen1 = row.insertCell(0); + var dozen2 = row.insertCell(1); + var dozen3 = row.insertCell(2); + dozen1.innerHTML = dozen1Count.innerHTML; + dozen2.innerHTML = dozen2Count.innerHTML; + dozen3.innerHTML = dozen3Count.innerHTML; + dozen1Count.innerHTML = 0; + dozen2Count.innerHTML = 0; + dozen3Count.innerHTML = 0; + } + + +} + + +input.addEventListener("keydown", function (e) { + if (e.keyCode === 13) { + addNumber(e); + } +}); + + +function updateAddedNumbers() { + var addedNumbersElem = document.getElementById("added-numbers"); + addedNumbersElem.innerHTML = addedNumbers.join(", "); // join array with commas +} \ No newline at end of file diff --git a/projects/gd-matrix/index-1.html b/projects/gd-matrix/resources/index-1.html similarity index 100% rename from projects/gd-matrix/index-1.html rename to projects/gd-matrix/resources/index-1.html diff --git a/projects/gd-matrix/index-2.html b/projects/gd-matrix/resources/index-2.html similarity index 100% rename from projects/gd-matrix/index-2.html rename to projects/gd-matrix/resources/index-2.html diff --git a/projects/gd-matrix/index-3.html b/projects/gd-matrix/resources/index-3.html similarity index 100% rename from projects/gd-matrix/index-3.html rename to projects/gd-matrix/resources/index-3.html diff --git a/projects/gd-matrix/index-4.html b/projects/gd-matrix/resources/index-4.html similarity index 100% rename from projects/gd-matrix/index-4.html rename to projects/gd-matrix/resources/index-4.html diff --git a/projects/gd-matrix/index-5-1.html b/projects/gd-matrix/resources/index-5-1.html similarity index 100% rename from projects/gd-matrix/index-5-1.html rename to projects/gd-matrix/resources/index-5-1.html diff --git a/projects/gd-matrix/index-5-2-1.html b/projects/gd-matrix/resources/index-5-2-1.html similarity index 100% rename from projects/gd-matrix/index-5-2-1.html rename to projects/gd-matrix/resources/index-5-2-1.html diff --git a/projects/gd-matrix/index-5-2.html b/projects/gd-matrix/resources/index-5-2.html similarity index 100% rename from projects/gd-matrix/index-5-2.html rename to projects/gd-matrix/resources/index-5-2.html diff --git a/projects/gd-matrix/index-5-3.html b/projects/gd-matrix/resources/index-5-3.html similarity index 98% rename from projects/gd-matrix/index-5-3.html rename to projects/gd-matrix/resources/index-5-3.html index 86f431d..5d1a75a 100644 --- a/projects/gd-matrix/index-5-3.html +++ b/projects/gd-matrix/resources/index-5-3.html @@ -2,7 +2,7 @@ - Number Tracker + Tracker