From aec87bab852e2b57d7bc16290b74602b32776f29 Mon Sep 17 00:00:00 2001 From: Createlex Date: Wed, 23 Jun 2021 22:19:43 -0700 Subject: [PATCH 01/13] Pig Commit Added CSS none and reset score and hide dice --- 07-Pig-Game/starter/script.js | 22 ++++++++++++++++++++++ 07-Pig-Game/starter/style.css | 5 +++++ 2 files changed, 27 insertions(+) diff --git a/07-Pig-Game/starter/script.js b/07-Pig-Game/starter/script.js index ad9a93a7c1..c3854f5fcd 100644 --- a/07-Pig-Game/starter/script.js +++ b/07-Pig-Game/starter/script.js @@ -1 +1,23 @@ 'use strict'; + + +const scoreElement0 = document.querySelector('#score--0'); +const scoreElement1 = document.getElementById('score--1'); +const diceElement = document.querySelector('.dice'); + + +scoreElement0.textContent = 0; +scoreElement1.textContent = 0; +diceElement.classList.add('hidden'); + + + +const btnRole = document.querySelector('.btn--roll'); +const diceImage = document.querySelector('.dice'); + +btnRole.addEventListener('click', function () { + + const MAXNUMBER = 6; + const randomNumber = Math.floor((Math.random() * MAXNUMBER) + 1); + console.log(diceImage.getElementsByClassName('dice')); +}); diff --git a/07-Pig-Game/starter/style.css b/07-Pig-Game/starter/style.css index dcf788f011..5d29703908 100644 --- a/07-Pig-Game/starter/style.css +++ b/07-Pig-Game/starter/style.css @@ -165,3 +165,8 @@ main { font-weight: 700; color: #c7365f; } + + +.hidden{ + display: none; +} \ No newline at end of file From 9631e02b9ba9df4c620c8e14f69a55e5f660b08c Mon Sep 17 00:00:00 2001 From: Createlex Date: Thu, 24 Jun 2021 20:03:29 -0700 Subject: [PATCH 02/13] Update script.js --- 07-Pig-Game/starter/script.js | 1 + 1 file changed, 1 insertion(+) diff --git a/07-Pig-Game/starter/script.js b/07-Pig-Game/starter/script.js index c3854f5fcd..dc7603150e 100644 --- a/07-Pig-Game/starter/script.js +++ b/07-Pig-Game/starter/script.js @@ -6,6 +6,7 @@ const scoreElement1 = document.getElementById('score--1'); const diceElement = document.querySelector('.dice'); +// initializes variables and reset game scoreElement0.textContent = 0; scoreElement1.textContent = 0; diceElement.classList.add('hidden'); From 57078c5d20b1468223df91571757e628f0b00c61 Mon Sep 17 00:00:00 2001 From: Createlex Date: Thu, 24 Jun 2021 20:42:53 -0700 Subject: [PATCH 03/13] RollDice Added Roll Dice and image change/ --- 07-Pig-Game/starter/script.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/07-Pig-Game/starter/script.js b/07-Pig-Game/starter/script.js index dc7603150e..9b525547c0 100644 --- a/07-Pig-Game/starter/script.js +++ b/07-Pig-Game/starter/script.js @@ -4,21 +4,48 @@ const scoreElement0 = document.querySelector('#score--0'); const scoreElement1 = document.getElementById('score--1'); const diceElement = document.querySelector('.dice'); +const btnNew = document.querySelector('.btn--new'); +const btnRoll = document.querySelector('.btn--roll'); +const btnHold = document.querySelector('.btn--hold'); +const currentElement0 = document.getElementById('current--0'); +const currentElement1 = document.getElementById('current--1'); + + + // initializes variables and reset game scoreElement0.textContent = 0; scoreElement1.textContent = 0; diceElement.classList.add('hidden'); +let currentScore = 0; const btnRole = document.querySelector('.btn--roll'); const diceImage = document.querySelector('.dice'); -btnRole.addEventListener('click', function () { +btnRoll.addEventListener('click', function () { const MAXNUMBER = 6; - const randomNumber = Math.floor((Math.random() * MAXNUMBER) + 1); - console.log(diceImage.getElementsByClassName('dice')); + const dice = Math.floor((Math.random() * MAXNUMBER) + 1); + + diceElement.classList.remove('hidden'); + diceElement.src = `dice-${dice}.png`; + + + if (dice !== 1) { + + // add to current score + currentScore += dice; + currentElement0.textContent = currentScore; + } else { + + + // switch to next player + } }); + + + + From b2aa34237905f7f4f59fd1291c90d1f4a64b3f25 Mon Sep 17 00:00:00 2001 From: Createlex Date: Sun, 27 Jun 2021 17:25:32 -0700 Subject: [PATCH 04/13] updated to current --- 01-Fundamentals-Part-1/.DS_Store | Bin 0 -> 6148 bytes 01-Fundamentals-Part-1/._.DS_Store | Bin 0 -> 4096 bytes 01-Fundamentals-Part-1/._final | Bin 0 -> 4096 bytes 01-Fundamentals-Part-1/._starter | Bin 0 -> 4096 bytes 01-Fundamentals-Part-1/final/._index.html | Bin 0 -> 4096 bytes 01-Fundamentals-Part-1/final/._script.js | Bin 0 -> 4096 bytes .../starter/._assignments.js | Bin 0 -> 4096 bytes 01-Fundamentals-Part-1/starter/._index.html | Bin 0 -> 4096 bytes 01-Fundamentals-Part-1/starter/._script.js | Bin 0 -> 4096 bytes 01-Fundamentals-Part-1/starter/assignments.js | 132 +++++++++ 01-Fundamentals-Part-1/starter/index.html | 59 ++-- 01-Fundamentals-Part-1/starter/script.js | 2 + 02-Fundamentals-Part-2/.DS_Store | Bin 0 -> 6148 bytes 02-Fundamentals-Part-2/._.DS_Store | Bin 0 -> 4096 bytes 02-Fundamentals-Part-2/._final | Bin 0 -> 4096 bytes 02-Fundamentals-Part-2/._starter | Bin 0 -> 4096 bytes 02-Fundamentals-Part-2/final/._index.html | Bin 0 -> 4096 bytes 02-Fundamentals-Part-2/final/._script.js | Bin 0 -> 4096 bytes 02-Fundamentals-Part-2/starter/._index.html | Bin 0 -> 4096 bytes 02-Fundamentals-Part-2/starter/._script.js | Bin 0 -> 4096 bytes 02-Fundamentals-Part-2/starter/script.js | 276 ++++++++++++++++++ 03-Developer-Skills/._final | Bin 0 -> 4096 bytes 03-Developer-Skills/._starter | Bin 0 -> 4096 bytes 03-Developer-Skills/final/._.prettierrc | Bin 0 -> 4096 bytes 03-Developer-Skills/final/._index.html | Bin 0 -> 4096 bytes 03-Developer-Skills/final/._script.js | Bin 0 -> 4096 bytes 03-Developer-Skills/starter/._index.html | Bin 0 -> 4096 bytes 03-Developer-Skills/starter/._script.js | Bin 0 -> 4096 bytes 03-Developer-Skills/starter/.prettierrc | 4 + 03-Developer-Skills/starter/script.js | 38 ++- 04-HTML-CSS/._final | Bin 0 -> 4096 bytes 04-HTML-CSS/final/._index.html | Bin 0 -> 4096 bytes 04-HTML-CSS/final/._style.css | Bin 0 -> 4096 bytes 04-HTML-CSS/index.html | 29 ++ 04-HTML-CSS/style.css | 48 +++ 05-Guess-My-Number/._final | Bin 0 -> 4096 bytes 05-Guess-My-Number/._starter | Bin 0 -> 4096 bytes 05-Guess-My-Number/final/._.prettierrc | Bin 0 -> 4096 bytes 05-Guess-My-Number/final/._index.html | Bin 0 -> 4096 bytes 05-Guess-My-Number/final/._script.js | Bin 0 -> 4096 bytes 05-Guess-My-Number/final/._style.css | Bin 0 -> 4096 bytes 05-Guess-My-Number/starter/._.prettierrc | Bin 0 -> 4096 bytes 05-Guess-My-Number/starter/._index.html | Bin 0 -> 4096 bytes 05-Guess-My-Number/starter/._script.js | Bin 0 -> 4096 bytes 05-Guess-My-Number/starter/._style.css | Bin 0 -> 4096 bytes 05-Guess-My-Number/starter/script.js | 53 ++++ 06-Modal/._final | Bin 0 -> 4096 bytes 06-Modal/._starter | Bin 0 -> 4096 bytes 06-Modal/final/._.prettierrc | Bin 0 -> 4096 bytes 06-Modal/final/._index.html | Bin 0 -> 4096 bytes 06-Modal/final/._script.js | Bin 0 -> 4096 bytes 06-Modal/final/._style.css | Bin 0 -> 4096 bytes 06-Modal/starter/._.prettierrc | Bin 0 -> 4096 bytes 06-Modal/starter/._index.html | Bin 0 -> 4096 bytes 06-Modal/starter/._script.js | Bin 0 -> 4096 bytes 06-Modal/starter/._style.css | Bin 0 -> 4096 bytes 06-Modal/starter/script.js | 31 ++ 57 files changed, 644 insertions(+), 28 deletions(-) create mode 100644 01-Fundamentals-Part-1/.DS_Store create mode 100644 01-Fundamentals-Part-1/._.DS_Store create mode 100644 01-Fundamentals-Part-1/._final create mode 100644 01-Fundamentals-Part-1/._starter create mode 100644 01-Fundamentals-Part-1/final/._index.html create mode 100644 01-Fundamentals-Part-1/final/._script.js create mode 100644 01-Fundamentals-Part-1/starter/._assignments.js create mode 100644 01-Fundamentals-Part-1/starter/._index.html create mode 100644 01-Fundamentals-Part-1/starter/._script.js create mode 100644 01-Fundamentals-Part-1/starter/assignments.js create mode 100644 01-Fundamentals-Part-1/starter/script.js create mode 100644 02-Fundamentals-Part-2/.DS_Store create mode 100644 02-Fundamentals-Part-2/._.DS_Store create mode 100644 02-Fundamentals-Part-2/._final create mode 100644 02-Fundamentals-Part-2/._starter create mode 100644 02-Fundamentals-Part-2/final/._index.html create mode 100644 02-Fundamentals-Part-2/final/._script.js create mode 100644 02-Fundamentals-Part-2/starter/._index.html create mode 100644 02-Fundamentals-Part-2/starter/._script.js create mode 100644 03-Developer-Skills/._final create mode 100644 03-Developer-Skills/._starter create mode 100644 03-Developer-Skills/final/._.prettierrc create mode 100644 03-Developer-Skills/final/._index.html create mode 100644 03-Developer-Skills/final/._script.js create mode 100644 03-Developer-Skills/starter/._index.html create mode 100644 03-Developer-Skills/starter/._script.js create mode 100644 03-Developer-Skills/starter/.prettierrc create mode 100644 04-HTML-CSS/._final create mode 100644 04-HTML-CSS/final/._index.html create mode 100644 04-HTML-CSS/final/._style.css create mode 100644 04-HTML-CSS/index.html create mode 100644 04-HTML-CSS/style.css create mode 100644 05-Guess-My-Number/._final create mode 100644 05-Guess-My-Number/._starter create mode 100644 05-Guess-My-Number/final/._.prettierrc create mode 100644 05-Guess-My-Number/final/._index.html create mode 100644 05-Guess-My-Number/final/._script.js create mode 100644 05-Guess-My-Number/final/._style.css create mode 100644 05-Guess-My-Number/starter/._.prettierrc create mode 100644 05-Guess-My-Number/starter/._index.html create mode 100644 05-Guess-My-Number/starter/._script.js create mode 100644 05-Guess-My-Number/starter/._style.css create mode 100644 06-Modal/._final create mode 100644 06-Modal/._starter create mode 100644 06-Modal/final/._.prettierrc create mode 100644 06-Modal/final/._index.html create mode 100644 06-Modal/final/._script.js create mode 100644 06-Modal/final/._style.css create mode 100644 06-Modal/starter/._.prettierrc create mode 100644 06-Modal/starter/._index.html create mode 100644 06-Modal/starter/._script.js create mode 100644 06-Modal/starter/._style.css diff --git a/01-Fundamentals-Part-1/.DS_Store b/01-Fundamentals-Part-1/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..6baece49c8f0a942d4d1657c1c044ad6ebf36424 GIT binary patch literal 6148 zcmeHK!AiqG5S`W5ZX;q3f*y16<{`DE=s^gz9=r(=J*d>gL>q{SB&kJfCBLD6JbZ;;)1 zQQ}Rl)d9_bX5jxZKxelMmk>e>E{vbw7w;wtv)r;?+1z}oyinoX;Kq`1=Jb+*le>98 zYrE+QjSk$r=PCa%Num$m^^U?|(52VnQ$)KI|V?Pu7IC6sX zDzA2HYr|n<%i1uTEo-!44!1YSZ?s0EDqmf%@9dvn-`x)%MvqUDRfboPkY$DM@Qlt_ ziGFqwdH5q~dMteFq;ZtQR~V&@Dv&{rjHGA-NXPEA|G-Pr+9odQzvgA4%n1^RA}uq^ zfI2XIab_#jg=q#f13zVe?gtZ<&{kMT6juit(E=crFf0Up>Ln=0RA?(KB;pJTlc|U@ zm8lkk$#jgHYMrgHkSNoEspf;JFEiDlF!6QV-xSM%*%GzY3}^;EGcYfQHG2Q|zVH7( zC+U%9Kr=8?46sti>9nyV^|nqGM{li(dX7p$>k5e?1&w-+g+ovA8mbVSGs!`;6&4aP Qf};Nj2pY7}4E!krZ$dnqTL1t6 literal 0 HcmV?d00001 diff --git a/01-Fundamentals-Part-1/._.DS_Store b/01-Fundamentals-Part-1/._.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..8e82ed96c0d694f6a640da6c163a3ef7e4194513 GIT binary patch literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIhYCu0iY;W;207T z1e9Qe=wPV8s%TVjGz3ONU^E0qLtr!nMnhmU1V%$(Gz3ONU^E0qLtr!ns2l>ojwq-z z3ITE<8JWcjMXAO4rA5i93TgR8*$SC?C8>EOnfZB%IXRUIIjLzS3Q0MMdD+0OE==1{ PrcwP5_lXRH-2eXo=JOoa literal 0 HcmV?d00001 diff --git a/01-Fundamentals-Part-1/._final b/01-Fundamentals-Part-1/._final new file mode 100644 index 0000000000000000000000000000000000000000..a42d8a73f88906b9a6608d464006bb44995a87a2 GIT binary patch literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)|I71HvHvK2D( rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wR3aWH+K|0htaGw`5=tP0r8NODrhJN!2SXO)N^xE6L1D1u1_E#2yR`{0RBn#N-?X za}xst3u9|DgG56!OEU}W;Ka1VqD*UJ6H^xhpq#F$nT46IiJ6h1u9KySk*<@YnX#Lb ziHos`xfwIV)aUB2ldkz2Hg39de%?pZ9A*Zi&-x<2+&t=*F0iWlQF2NeWb-H(4S~@R z7!85Z5Eu=C(GVC7fzc2c4S~@R7!85Z5Ezmn0PKi@I-?LE7m|@#tWcC%oL^d$oT`wP xUzDwonOBku>~`koCFbN*D&(Z5l_(_TB<5uU`@%47LzzbPKinrW408Yf0{~5*N__wT literal 0 HcmV?d00001 diff --git a/01-Fundamentals-Part-1/final/._index.html b/01-Fundamentals-Part-1/final/._index.html new file mode 100644 index 0000000000000000000000000000000000000000..a42d8a73f88906b9a6608d464006bb44995a87a2 GIT binary patch literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)|I71HvHvK2D( rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)|I71HvHvK2D( rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wMg?WDB5a0m{L|rIPb=^%4sTa#Hnj5{pYpi&Ill5=&B*1A;+%I4GBS%5ic*X7 zON)|I71HvHvK2D(N>cMmGV}8ib8;#ba#GVu6q0fh^Rj_`VW_SlO`-Z9?iCpZx&QwG D)M+U` literal 0 HcmV?d00001 diff --git a/01-Fundamentals-Part-1/starter/._index.html b/01-Fundamentals-Part-1/starter/._index.html new file mode 100644 index 0000000000000000000000000000000000000000..1c1434f0662cafb1dc6811dd0feeca60488df51e GIT binary patch literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wLViWP74%0htaGw`5=tP0r8NODrhJN!2SXO)N^xE6L1D1u6dt!~zTqQV98+#Nv|D z;?$Is#FA9yfM5nALtO&{3u9|DgG56!OEU}W;Ka1VqD*UJ6H^xha}xtyQ!@)QT@y2) zIwwmLBV8v)Gh;U=6BlC>b2FB^3ll)LY`td61ENR4Xb6mkz-S1JhQMeDjE2By2#kin zXb6mkz-S1JhQN>y0boZI)ER{UxsZ&^VuhmA;{4L0$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wMg?WDB5a0m{L|rIPb=^%4sTa#Hnj5{pYpi&Ill5=&B*1A;+%G%oB;0MQfMc=SQ^ zC>RZa(GVC7fzc2c4S~@R7!85Z5Eu=C(GVC7fzc2c4FOys0P1XlFc`>%WMmdA6r~pD zmlh?bDx~EXWh-Rnm89mCWaj53=Hyf=!cbj9nnLwI+$%B+a{vDW E04&NWWdHyG literal 0 HcmV?d00001 diff --git a/01-Fundamentals-Part-1/starter/assignments.js b/01-Fundamentals-Part-1/starter/assignments.js new file mode 100644 index 0000000000..bbd747ee6f --- /dev/null +++ b/01-Fundamentals-Part-1/starter/assignments.js @@ -0,0 +1,132 @@ +const country = 'United States'; +const continent = 'North America'; +let population = 328000000; +let isIsland = false; +const language = 'English'; + +console.log(country); +console.log(continent); +console.log(population); +console.log(isIsland); +console.log(language); + +const halfPopulation = population / 2 / 2; +console.log(halfPopulation); +population++; +console.log(population); +const hasMorePopulationThanFinlans = population > 6000000; +console.log(hasMorePopulationThanFinlans); +const lessThanAverageCountryPopulation = population < 33000000; +const description = `${country} is in ${continent} and its ${population} million people speak ${language}`; +console.log(description); + + +//Coding Challenge #1 +const marksMass = 82; +const MarksHeight = 1.95; +const JohnsMass = 78; +const JohnsHeight = 1.68; + +const marksBMI = marksMass / (MarksHeight * MarksHeight); +const johnsBMI = JohnsMass / (JohnsHeight * JohnsHeight); + +const markHigherBMI = marksMass > johnsBMI; + +console.log(marksBMI, johnsBMI); +const averagePopulation = 33000000; +if (population > averagePopulation) { + console.log(`${country} population is about average`); + +} else { + console.log(`${country} population is ${averagePopulation - population} below averaeg `); +} + + +if (marksBMI > johnsBMI) { + + console.log(`Marks BMI(${marksBMI}) is hgher then Johns BMI(${johnsBMI})`); + +} else { + console.log(`Johns BMI(${johnsBMI}) is higher then Marks BMI(${marksBMI})`); +} + +console.log('123' < 56); + +// let numNeighbours = Number(prompt(`How many neighbours country does your country have ?`)); + +// if (numNeighbours === 1) { + +// console.log(`Only 1 neigbouring country`); +// } else if (numNeighbours > 1) { +// console.log(`Greater then 1 neigbouring country`); + +// } else { +// console.log(`No borders`); + +// } + +//LECTURE: Logical Operators + + +if (language === 'English' && population <= 50000000 && isIsland == false) { + console.log(`Your should live in the ${country}`); +} else { + console.log(`${country} doesnt meet your criteria`); + +} + + +//LECTURE: The switch Statement + + +switch (language) { + case `chinese`, `manderine`, `Chinese`: + console.log(`MOST number of native speakers`); + break; + case `spanish`: + console.log(`2nd most native speakers`); + break; + case `english`, `English`: + console.log(`3rd most native speakers`) + break; + + default: + console.log(`also a great language too`); + break; +} + +//LECTURE: The Conditional (Ternary) Operator +console.log(`${country} populations is ${population > 33000000 ? "above" : "below"} average`) +//const populationOver33mil = population > 33000000 ? console.log(`${ country } is above average`) : console.log(`${ country } is below averae`); + + +//Coding Challenge #3 + +const dolphinsScore1 = 98; +const dolphinsScore2 = 109; +const dolphinsScore3 = 96; + +const koalasScore1 = 88; +const koalasScore2 = 91; +const koalasScore3 = 110; +const MINSCORE = 100; + + +const dolphinsAverageScore = (dolphinsScore1 + dolphinsScore2 + dolphinsScore3) / 3; +const koalasAverageScore = (koalasScore1 + koalasScore2 + koalasScore3) / 3; + +if (dolphinsAverageScore >= MINSCORE && dolphinsAverageScore > koalasAverageScore) { + console.log(`Dolphines Avergge score(${dolphinsAverageScore}) greater than koalas average score(${koalasAverageScore})`); +} else if (dolphinsAverageScore < koalasAverageScore && koalasAverageScore >= MINSCORE) { + console.log(`Koalas Avergge score(${koalasAverageScore}) greater than dalphins average score(${dolphinsAverageScore})`); + +} else if (dolphinsAverageScore === koalasAverageScore && koalasAverageScore >= MINSCORE) { + console.log(`We have a draw`); +} + +//Coding Challenge #4 +const bill = 275; +const tip = bill >= 50 && bill <= 300 ? bill * (15 / 100) : bill * (20 / 100); +console.log(`${tip}% `); + +console.log(`The bill was ${bill}, the tip was ${tip}, and the total value ${bill + tip}`); diff --git a/01-Fundamentals-Part-1/starter/index.html b/01-Fundamentals-Part-1/starter/index.html index 59529c7923..2338a305b0 100755 --- a/01-Fundamentals-Part-1/starter/index.html +++ b/01-Fundamentals-Part-1/starter/index.html @@ -1,29 +1,34 @@ - - - - - JavaScript Fundamentals – Part 1 - - - -

JavaScript Fundamentals – Part 1

- - + + + + + + JavaScript Fundamentals – Part 1 + + + + +

JavaScript Fundamentals – Part 1

+ + + + \ No newline at end of file diff --git a/01-Fundamentals-Part-1/starter/script.js b/01-Fundamentals-Part-1/starter/script.js new file mode 100644 index 0000000000..c3640957c4 --- /dev/null +++ b/01-Fundamentals-Part-1/starter/script.js @@ -0,0 +1,2 @@ +console.log("Hello World"); +alert("Javascript is FUN"); \ No newline at end of file diff --git a/02-Fundamentals-Part-2/.DS_Store b/02-Fundamentals-Part-2/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4ee372ccf2dee2e21a92520c7ae17b44f73db402 GIT binary patch literal 6148 zcmeHK%}V4z5Uw6)*TjJ(3wv ze1P@3>U*dU;fr{;s=F0*^s0kYLDg4OS5-P+hVCf<5Up;s0N?B`gW60f`kAHv`^nJ4{_x_JV}#MHk)^%Hc|ibb<(n@ z8g}Db!#?mkdEb|T?3S&dXgf2062)Oq>?V=yY{%JJ8u#LCqgW4QTj3}grUShLyX{O52FuNr zd3SkfVL0y&Ru-G&{~8W$%lbL@XX~(gdiL-9|Hb9i^^K|mfj?O#-wi&(EjlkKiOS01lWNDuL#g)f~l*PgfFaylMI5S|*E2}Zio8-MQ1I)mOFhJ*ni%RGjtTd{l z1C1I15bGFLfRO1@-3|1O(1x4smL|rP(h#_=2#$A)=8LTwwau8aVu&-OSxO@|JYhx~NB} qB$QWad@4alUB#G7SMfBe5{$d#AbJKXjTk}UKLUydHq5}gGVlNg8fka{ literal 0 HcmV?d00001 diff --git a/02-Fundamentals-Part-2/._.DS_Store b/02-Fundamentals-Part-2/._.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..8e82ed96c0d694f6a640da6c163a3ef7e4194513 GIT binary patch literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIhYCu0iY;W;207T z1e9Qe=wPV8s%TVjGz3ONU^E0qLtr!nMnhmU1V%$(Gz3ONU^E0qLtr!ns2l>ojwq-z z3ITE<8JWcjMXAO4rA5i93TgR8*$SC?C8>EOnfZB%IXRUIIjLzS3Q0MMdD+0OE==1{ PrcwP5_lXRH-2eXo=JOoa literal 0 HcmV?d00001 diff --git a/02-Fundamentals-Part-2/._final b/02-Fundamentals-Part-2/._final new file mode 100644 index 0000000000000000000000000000000000000000..a42d8a73f88906b9a6608d464006bb44995a87a2 GIT binary patch literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)|I71HvHvK2D( rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wR3aWH+K|0htaGw`5=tP0r8NODrhJN!2SXO)N^xE6L1D1u1_E#2yR`{0RBn#N-?X za}xst3u9|DgG56!OEU}W;Ka1VqD*UJ6H^xhpq#F$nT46IiJ6h1u9KySk*<@YnX#Lb ziHos`xfwHq(Pw>;Uv3_COBYyG{U|vl4YFqxjE2By2#kinXb6mkz-S1JhQMeDjE2By z2#kinXb23G5CC>WL7h$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z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@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC (population / 7900) * 100; +console.log(percentageOfWorld3(3944)); + + +function describePopulation(population, country) { + + return `${country} has ${population} million people which is ${percentageOfWorld1(population)} of the world`; +} + +console.log(describePopulation(1441, "United States")); + + +// #coding Challenge 1 + +//dolphins and the Koalas + +// + +const dolphinsScore1 = 85; +const dolphinsScore2 = 54; +const dolphinsScore3 = 41; + +const koalasScore1 = 23; +const koalasScore2 = 34; +const koalasScore3 = 27; + +function calcAverage(score1, score2, score3) { + return (score1 + score2 + score3) / 3; +} + + +const dolphinsAverageScore = calcAverage(dolphinsScore1, dolphinsScore2, dolphinsScore3); +const KoalasAverageScoer = calcAverage(koalasScore1, koalasScore2, koalasScore3); + +console.log(dolphinsAverageScore, KoalasAverageScoer); + +function checkWinner(teamName1, team1Score, teamName2, team2Score) { + if (team1Score >= 2 * team2Score) { + console.log(`${teamName1} wins ${team1Score} vs ${team2Score}`); + } else if (team2Score >= 2 * team1Score) { + console.log(`${teamName2} wins ${team2Score} vs ${team1Score}`); + + } +} + +checkWinner('Dolphins', dolphinsAverageScore, "Koalas", KoalasAverageScoer); + + + +const populations = [2290, 9000, 3193, 8800]; +if (populations.length === 4) { + console.log(`true`); +} else { + console.log(`false`); +} +const percentages = [percentageOfWorld1(populations[0]), percentageOfWorld1(populations[1]), percentageOfWorld1(populations[2]), percentageOfWorld1(populations[3])]; +console.log(percentages); + + +const friends = ["Shaun", "Gilbert", "Adam"]; +friends.push("John"); +const popped = friends.pop(); +console.log(popped); +friends.unshift("Johnny"); +console.log(friends); + +const neighbours = Array('Mexico', 'Canada'); +neighbours.push("Utopia"); +neighbours.pop(); // removing it from the array + +console.log(neighbours); +if (neighbours.includes("Germany")) { + +} else { + console.log(`Not in a centrual European Country :D`); +} + +const neighboursLength = neighbours.length; +const indexOfCanada = neighbours.indexOf("Canada"); +neighbours[indexOfCanada] = "Wakanda"; +console.log(neighbours); + +const bills = Array(22, 295, 176, 440, 38, 105, 10, 1100, 86, 52); +const tips = Array(); +const total = Array(); +function calTip(billAmount) { + + if (billAmount >= 50 && billAmount <= 300) { + return billAmount * .15; + } else { + return billAmount * .20; + } +} + +for (let i = 0; i < bills.length; i++) { + tips.push(calTip(bills[i])); + total.push(tips[i] + bills[i]); + +} +//tips.push(calTip(bills[0], calTip(bills[1]), calTip(bills[2]))); +//total.push(bills[0] + tips[0], bills[1] + tips[1], bills[2] + tips[2]); + + + + +console.log(` Tip is ${calTip(436)}`); + +//create an aobject +const myCountry = { + country: "United States", + capital: "Washington DC", + language: "English", + populations: 321, + neighbours: 2, + describe: function () { + console.log(`${this.country} has ${this.populations} million ${this.language} speaking people, ${this.neighbours} neighbouring countries and a capital called ${this.capital}`); + }, + checkIsland: function () { + this.isIsland = this.neighbours > 0 ? true : false; + return this.isIsland; + } + + + + +}; + +myCountry.describe(); + +myCountry.populations = myCountry.populations + 2; // increate by 2 million using dot notation +console.log(`Population is ${myCountry.populations}`); + +myCountry["populations"] = myCountry['populations'] - 2; + +console.log(`Population is ${myCountry.populations}`); +myCountry.checkIsland(); +console.log(myCountry.isIsland); +//console.log(myCountry.describe()); + +// LECTURE: Dot vs. Bracket Notation + + +//Coding Challenge #3 +// 1. Foreachofthem,createanobjectwithpropertiesfortheirfullname,mass,and height (Mark Miller and John Smith) +const markkMiller = { + fullName: "Mark Miller", + mass: 78, + height: 1.69, + calcBMI: function () { + return this.calcBMI = this.mass / this.height ** 2; + + } + +}; + +const johnSmith = { + fullName: "John Smith", + mass: 92, + height: 1.95, + calcBMI: function () { + return this.calcBMI = this.mass / (this.height * this.height); + + } + +}; + + +if (markkMiller.calcBMI() > johnSmith.calcBMI()) { + console.log(`${markkMiller.fullName} BMI(${markkMiller.calcBMI}) is Higher then ${johnSmith.fullName} BMI(${johnSmith.calcBMI})`); +} else { + + console.log(`${johnSmith.fullName} BMI(${johnSmith.calcBMI}) is Higher then ${markkMiller.fullName} BMI(${markkMiller.calcBMI})`); + +} + + +//LECTURE: Iteration: The for Loop +//'Voter number 1 is currently voting' +for (let x = 1; x <= 10; x++) { + // console.log(`Voter Number ${x} is curerntly voting`); +} + + +//LECTURE: Looping Arrays, Breaking and Continuing + +const percentages2 = []; +for (let x = 0; x < populations.length; x++) { + percentages2.push(percentageOfWorld1(populations[x])); + +} +for (let b = 0; b < percentages2.length; b++) { + if (percentages[b] === percentages2[b]) { + console.log("Match"); + } + +} + +// LECTURE: Looping Backwards and Loops in Loops +const listOfNeighbours = [['Canada', 'Mexico'], ['Spain'], ['Norway', 'Sweden', 'Russia']]; +for (let x = 0; x < listOfNeighbours.length; x++) { + + for (let y = 0; y < listOfNeighbours[x].length; y++) { + + console.log(listOfNeighbours[x][y]); + + } +} + + +const percentages3 = []; +let conter = 0; +while (conter < populations.length) { + + percentages3.push(percentageOfWorld2(populations[conter])); + console.log(Math.trunc(percentages3[conter])); + conter++; +} + +//Coding Challenge #4 + +console.log(tips); +console.log(total); + +const calcAverage2 = function (arrayA) { + + let result = 0; + for (let i = 0; i < arrayA.length; i++) { + + result = result + arrayA[i]; + + + } + console.log(`total ${result}`); + return result / arrayA.length; +} +const arrayExample = Array(70, 99, 80, 78); +console.log(calcAverage2(arrayExample)); \ No newline at end of file diff --git a/03-Developer-Skills/._final b/03-Developer-Skills/._final new file mode 100644 index 0000000000000000000000000000000000000000..a42d8a73f88906b9a6608d464006bb44995a87a2 GIT binary patch literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)|I71HvHvK2D( rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC$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IUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)|I71HvHvK2D( rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)|I71HvHvK2D( rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC + + + + + + + Document + + +

hello goyes

+

+ whats going on guys its a me checking out the css and html +

+
whats going on people
+

just doing some things thart i loev to lear

+ site here + +
+

Your name here

+

please fill in the blank

+ + +
+ + diff --git a/04-HTML-CSS/style.css b/04-HTML-CSS/style.css new file mode 100644 index 0000000000..fe29c12ffb --- /dev/null +++ b/04-HTML-CSS/style.css @@ -0,0 +1,48 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: rgb(131, 131, 46); + font-family: Arial; + font-size: 20px; + padding: 50px; +} + +h1 { + font-size: 40px; + margin-bottom: 25px; +} + +.first { + color: red; +} + +#your-name { + background-color: burlywood; + color: rgb(0, 255, 8); + border: 5px solid rgb(21, 103, 128); + width: 400px; + text-align: center; +} + +input, +button { + padding: 10px; + font-size: 16px; +} + +p { + margin-bottom: 20px; +} + +#course-name { + width: 300px; + /* height: 300px; */ +} + +#your-name h2 { + color: olivedrab; +} diff --git a/05-Guess-My-Number/._final b/05-Guess-My-Number/._final new file mode 100644 index 0000000000000000000000000000000000000000..a42d8a73f88906b9a6608d464006bb44995a87a2 GIT binary patch literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)|I71HvHvK2D( rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)|I71HvHvK2D( rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)|I71HvHvK2D( rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|M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rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)|I71HvHvK2D( rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)|I71HvHvK2D( rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)|I71HvHvK2D( rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC highscore) { + highscore = score; + document.querySelector('.highscore').textContent = score; + } + } else if (guess !== secreteNumber) { + if (score > 1) { + const bMessage = guess > secreteNumber ? 'Too High' : 'Too Low '; + document.querySelector('.message').textContent = bMessage; + score--; + + document.querySelector('.score').textContent = score; + } else { + document.querySelector('.message').textContent = 'You Lose'; + document.querySelector('.number').style.width = '30rem'; + document.querySelector('.score').textContent = 0; + } + } +}); + +document.querySelector('.again').addEventListener('click', function () { + initGame(); +}); diff --git a/06-Modal/._final b/06-Modal/._final new file mode 100644 index 0000000000000000000000000000000000000000..a42d8a73f88906b9a6608d464006bb44995a87a2 GIT binary patch literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)|I71HvHvK2D( rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)|I71HvHvK2D( rN>YK{&iuT@oSaI9oYb@ug`}Lsylh}!7^-VXQ>gxjdqsvp?*D%PC$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v0xDsI z=wO%uWLu(X0m{L|MU(S$^%4sTa#HmQOB0I{^GY)FQW*>kER3zq3=$2^EX^#egA>yd zi!!Z^O-x-3%uNh*P0cLKbWO~R40W9>O^kG%9LEEE?sGhQMeDjE2By z2#kinXb6mkz-S1JhQMeDjE2By2#lN%0ChG&7!2e>GBS%5ic*X7ON)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h}!7^-VXQ>gxjdqsvp?*D%PC Date: Sun, 27 Jun 2021 20:48:43 -0700 Subject: [PATCH 05/13] Patricia Updaet --- 07-Pig-Game/starter/script.js | 42 +++++++++++------------------------ 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/07-Pig-Game/starter/script.js b/07-Pig-Game/starter/script.js index 9b525547c0..445dc50a87 100644 --- a/07-Pig-Game/starter/script.js +++ b/07-Pig-Game/starter/script.js @@ -1,6 +1,5 @@ 'use strict'; - const scoreElement0 = document.querySelector('#score--0'); const scoreElement1 = document.getElementById('score--1'); const diceElement = document.querySelector('.dice'); @@ -10,42 +9,27 @@ const btnHold = document.querySelector('.btn--hold'); const currentElement0 = document.getElementById('current--0'); const currentElement1 = document.getElementById('current--1'); - - - - // initializes variables and reset game scoreElement0.textContent = 0; scoreElement1.textContent = 0; diceElement.classList.add('hidden'); let currentScore = 0; - - const btnRole = document.querySelector('.btn--roll'); const diceImage = document.querySelector('.dice'); btnRoll.addEventListener('click', function () { - - const MAXNUMBER = 6; - const dice = Math.floor((Math.random() * MAXNUMBER) + 1); - - diceElement.classList.remove('hidden'); - diceElement.src = `dice-${dice}.png`; - - - if (dice !== 1) { - - // add to current score - currentScore += dice; - currentElement0.textContent = currentScore; - } else { - - - // switch to next player - } + const MAXNUMBER = 6; + const dice = Math.floor(Math.random() * MAXNUMBER + 1); + + diceElement.classList.remove('hidden'); + diceElement.src = `dice-${dice}.png`; + + if (dice !== 1) { + // add to current score + currentScore += dice; + currentElement0.textContent = currentScore; + } else { + // switch to next player.. + } }); - - - - From e8362d42987317ea6ec2e8837f37eea5c4e7b926 Mon Sep 17 00:00:00 2001 From: Createlex Date: Sun, 27 Jun 2021 21:29:15 -0700 Subject: [PATCH 06/13] Update script.js --- 07-Pig-Game/starter/script.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/07-Pig-Game/starter/script.js b/07-Pig-Game/starter/script.js index 445dc50a87..ad26d3bacd 100644 --- a/07-Pig-Game/starter/script.js +++ b/07-Pig-Game/starter/script.js @@ -9,8 +9,17 @@ const btnHold = document.querySelector('.btn--hold'); const currentElement0 = document.getElementById('current--0'); const currentElement1 = document.getElementById('current--1'); +const playerOne = document.querySelector('.player--0'); +const playerTwo = document.querySelector('.player--1'); + + +const score =[0,0]; +const currentScore = 0; +const activePlayer = 0; + + // initializes variables and reset game -scoreElement0.textContent = 0; +document.scoreElement0.textContent = 0); scoreElement1.textContent = 0; diceElement.classList.add('hidden'); let currentScore = 0; @@ -28,8 +37,12 @@ btnRoll.addEventListener('click', function () { if (dice !== 1) { // add to current score currentScore += dice; + activePlayer = currentElement0.textContent = currentScore; } else { // switch to next player.. + document.getElementById(`current--${activePlayer}`).textContent = activePlayer; + activePlayer = activePlayer === 0 ? 1 : 0; + currentScore = 0; } }); From 5b6b594e72a4dc55dfc50800d37df243a7b4fc20 Mon Sep 17 00:00:00 2001 From: Createlex Date: Mon, 28 Jun 2021 21:13:42 -0700 Subject: [PATCH 07/13] Switching Active Player Switching Active player --- 07-Pig-Game/starter/script.js | 47 +++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/07-Pig-Game/starter/script.js b/07-Pig-Game/starter/script.js index ad26d3bacd..7bf0df76c2 100644 --- a/07-Pig-Game/starter/script.js +++ b/07-Pig-Game/starter/script.js @@ -1,5 +1,8 @@ 'use strict'; + + + const scoreElement0 = document.querySelector('#score--0'); const scoreElement1 = document.getElementById('score--1'); const diceElement = document.querySelector('.dice'); @@ -9,20 +12,20 @@ const btnHold = document.querySelector('.btn--hold'); const currentElement0 = document.getElementById('current--0'); const currentElement1 = document.getElementById('current--1'); -const playerOne = document.querySelector('.player--0'); -const playerTwo = document.querySelector('.player--1'); +const playerOneElement = document.querySelector('.player--0'); +const playerTwoElement = document.querySelector('.player--1'); + + +const score = [0, 0]; +let activePlayer = 0; +let currentScore = 0; -const score =[0,0]; -const currentScore = 0; -const activePlayer = 0; - // initializes variables and reset game -document.scoreElement0.textContent = 0); +scoreElement0.textContent = 0; scoreElement1.textContent = 0; diceElement.classList.add('hidden'); -let currentScore = 0; const btnRole = document.querySelector('.btn--roll'); const diceImage = document.querySelector('.dice'); @@ -34,15 +37,37 @@ btnRoll.addEventListener('click', function () { diceElement.classList.remove('hidden'); diceElement.src = `dice-${dice}.png`; + //starts on player 1 + // + if (dice !== 1) { // add to current score currentScore += dice; - activePlayer = - currentElement0.textContent = currentScore; + document.getElementById(`current--${activePlayer}`).textContent = currentScore; } else { // switch to next player.. - document.getElementById(`current--${activePlayer}`).textContent = activePlayer; + + document.getElementById(`current--${activePlayer}`).textContent = 0; activePlayer = activePlayer === 0 ? 1 : 0; currentScore = 0; + + // Toogle method for switching background collor + playerOneElement.classList.toggle('player--active'); + playerTwoElement.classList.toggle('player--active'); + + + //toogle + + + //reset both current scores to 0; + currentElement0.textContent = 0; + currentElement1.textContent = 0; + + + + + + + } }); From 9f11af3f290b3c9d64eb0b62caba61238baf335c Mon Sep 17 00:00:00 2001 From: Createlex Date: Mon, 28 Jun 2021 22:26:23 -0700 Subject: [PATCH 08/13] Holding CurrentScore Holding Current Score --- 07-Pig-Game/starter/script.js | 96 +++++++++++++++++++++-------------- 1 file changed, 57 insertions(+), 39 deletions(-) diff --git a/07-Pig-Game/starter/script.js b/07-Pig-Game/starter/script.js index 7bf0df76c2..34d9cad0a5 100644 --- a/07-Pig-Game/starter/script.js +++ b/07-Pig-Game/starter/script.js @@ -1,8 +1,5 @@ 'use strict'; - - - const scoreElement0 = document.querySelector('#score--0'); const scoreElement1 = document.getElementById('score--1'); const diceElement = document.querySelector('.dice'); @@ -15,12 +12,10 @@ const currentElement1 = document.getElementById('current--1'); const playerOneElement = document.querySelector('.player--0'); const playerTwoElement = document.querySelector('.player--1'); - const score = [0, 0]; let activePlayer = 0; let currentScore = 0; - - +let isPlaying = true; // initializes variables and reset game scoreElement0.textContent = 0; @@ -30,44 +25,67 @@ diceElement.classList.add('hidden'); const btnRole = document.querySelector('.btn--roll'); const diceImage = document.querySelector('.dice'); -btnRoll.addEventListener('click', function () { - const MAXNUMBER = 6; - const dice = Math.floor(Math.random() * MAXNUMBER + 1); - - diceElement.classList.remove('hidden'); - diceElement.src = `dice-${dice}.png`; - - //starts on player 1 - // - - if (dice !== 1) { - // add to current score - currentScore += dice; - document.getElementById(`current--${activePlayer}`).textContent = currentScore; - } else { - // switch to next player.. - - document.getElementById(`current--${activePlayer}`).textContent = 0; - activePlayer = activePlayer === 0 ? 1 : 0; - currentScore = 0; - - // Toogle method for switching background collor - playerOneElement.classList.toggle('player--active'); - playerTwoElement.classList.toggle('player--active'); - - - //toogle - - - //reset both current scores to 0; - currentElement0.textContent = 0; - currentElement1.textContent = 0; - +const switchPlayer = function () { + // switch to next player.. + document.getElementById(`current--${activePlayer}`).textContent = 0; + activePlayer = activePlayer === 0 ? 1 : 0; + currentScore = 0; + // Toogle method for switching background collor + playerOneElement.classList.toggle('player--active'); + playerTwoElement.classList.toggle('player--active'); + //toogle + //reset both current scores to 0; + currentElement0.textContent = 0; + currentElement1.textContent = 0; +}; +btnRoll.addEventListener('click', function () { + if (isPlaying) { + const MAXNUMBER = 6; + const dice = Math.floor(Math.random() * MAXNUMBER + 1); + + diceElement.classList.remove('hidden'); + diceElement.src = `dice-${dice}.png`; + + //starts on player 1 + // + + if (dice !== 1) { + // add to current score + currentScore += dice; + document.getElementById(`current--${activePlayer}`).textContent = + currentScore; + } else { + switchPlayer(); + } + } +}); +btnHold.addEventListener('click', function () { + if (isPlaying) { + console.log(`hold`); + // Add player score + score[activePlayer] += currentScore; + + document.getElementById(`score--${activePlayer}`).textContent = + score[activePlayer]; + + if (score[activePlayer] >= 20) { + isPlaying = false; + diceElement.classList.add(`hidden`); + document + .querySelector(`.player--${activePlayer}`) + .classList.add('player--winner'); + + document + .querySelector(`.player--${activePlayer}`) + .classList.remove('player--active'); + } else { + switchPlayer(); + } } }); From 33dc5a6dc663873ccbfda21d6e5e89ffa50dd727 Mon Sep 17 00:00:00 2001 From: Createlex Date: Wed, 30 Jun 2021 21:54:33 -0700 Subject: [PATCH 09/13] Added reset Init Added Reset and Init Method. --- 07-Pig-Game/starter/script.js | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/07-Pig-Game/starter/script.js b/07-Pig-Game/starter/script.js index 34d9cad0a5..f212b22d0b 100644 --- a/07-Pig-Game/starter/script.js +++ b/07-Pig-Game/starter/script.js @@ -17,6 +17,53 @@ let activePlayer = 0; let currentScore = 0; let isPlaying = true; +const init = function () { + + //reset aind init method + score[0] = 0; + score[1] = 0; + activePlayer = 0; + currentScore = 0; + isPlaying = true; + + + + isPlaying = true; + + // reset current scoe + currentElement0.textContent = 0; + currentElement1.textContent = 0; + + //Remove Winner Height + document.querySelector(`.player--${activePlayer}`).classList.remove(`player--winner`); + // document.querySelector(`.player--1`).classList.remove(`player--winner`); + + // remove background tap + playerOneElement.classList.remove(`player-active`); + playerOneElement.classList.add(`player--active`); + + // Switch Active Player + activePlayer = 0; + + // current score reset + currentScore = 0; + + score[0] = 0; + score[1] = 0; + + + document.getElementById(`score--0`).textContent = 0; + document.getElementById(`score--1`).textContent = 0; + + + // Hide Dice + diceElement.classList.add('Hidden'); + + + +}; + +init(); // initializes variables and reset game scoreElement0.textContent = 0; scoreElement1.textContent = 0; @@ -89,3 +136,6 @@ btnHold.addEventListener('click', function () { } } }); + + +btnNew.addEventListener('click', init); \ No newline at end of file From d60b29d496b56467d5c55f2c56376695ab89c9c0 Mon Sep 17 00:00:00 2001 From: Createlex Date: Thu, 1 Jul 2021 09:25:31 -0700 Subject: [PATCH 10/13] Bug Fix Winners Fixed Bug for removing player wiinner after win by adding remove player--0 and player--1 winners --- 07-Pig-Game/starter/script.js | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/07-Pig-Game/starter/script.js b/07-Pig-Game/starter/script.js index f212b22d0b..75f0e86906 100644 --- a/07-Pig-Game/starter/script.js +++ b/07-Pig-Game/starter/script.js @@ -18,7 +18,6 @@ let currentScore = 0; let isPlaying = true; const init = function () { - //reset aind init method score[0] = 0; score[1] = 0; @@ -26,17 +25,16 @@ const init = function () { currentScore = 0; isPlaying = true; - - isPlaying = true; - // reset current scoe + // reset current scoe currentElement0.textContent = 0; currentElement1.textContent = 0; //Remove Winner Height - document.querySelector(`.player--${activePlayer}`).classList.remove(`player--winner`); - // document.querySelector(`.player--1`).classList.remove(`player--winner`); + document.querySelector(`.player--0`).classList.remove(`player--winner`); + document.querySelector(`.player--1`).classList.remove(`player--winner`); + //Fixed Bug for removing player wiinner after win by adding remove player--0 and player--1 winners // remove background tap playerOneElement.classList.remove(`player-active`); @@ -45,22 +43,17 @@ const init = function () { // Switch Active Player activePlayer = 0; - // current score reset + // current score reset currentScore = 0; score[0] = 0; score[1] = 0; - document.getElementById(`score--0`).textContent = 0; document.getElementById(`score--1`).textContent = 0; - - // Hide Dice + // Hide Dice diceElement.classList.add('Hidden'); - - - }; init(); @@ -137,5 +130,4 @@ btnHold.addEventListener('click', function () { } }); - -btnNew.addEventListener('click', init); \ No newline at end of file +btnNew.addEventListener('click', init); From 0ab14949a802d99abed89c734c776a5bcce2fe6d Mon Sep 17 00:00:00 2001 From: Createlex Date: Wed, 21 Jul 2021 21:16:50 -0700 Subject: [PATCH 11/13] Update script.js + spread operator + Method and Object Desuctor --- .../starter/script.js | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/09-Data-Structures-Operators/starter/script.js b/09-Data-Structures-Operators/starter/script.js index 2cc0fea5a0..e219adc499 100644 --- a/09-Data-Structures-Operators/starter/script.js +++ b/09-Data-Structures-Operators/starter/script.js @@ -26,4 +26,33 @@ const restaurant = { close: 24, }, }, + orderPasta: function (ing1, ing2, ing3) { + console.log(`Your Pasta order has ${ing1}, ${ing2}, and ${ing3}`); + }, }; + +// +console.log(`whats going on people`); +const { name, categories } = restaurant; + +// spread operator +const newMenu = [...restaurant.mainMenu]; +console.log(newMenu); +const newMenuCopy = [...newMenu, ...restaurant.mainMenu]; +console.log(newMenuCopy); + +const ingredients = [ + prompt('Enter 1st ingredients'), + prompt('Enter 2nd ingredients'), + prompt('Enter last ingredients'), +]; + +restaurant.orderPasta(...ingredients); + +// create shallow copy of object + +const restaurant2 = { ...restaurant }; + +// create shallow copy woth custom property +const restaurant3 = { founder: 1998, ...restaurant }; +console.log(restaurant3); From a70470e3d4c03d139afb9132ea6d88caef8b7429 Mon Sep 17 00:00:00 2001 From: Createlex Date: Fri, 10 Sep 2021 16:14:35 -0700 Subject: [PATCH 12/13] adding display adding display fucntio --- .DS_Store | Bin 0 -> 6148 bytes 11-Arrays-Bankist/.DS_Store | Bin 0 -> 6148 bytes 11-Arrays-Bankist/starter/script.js | 18 ++++++++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 .DS_Store create mode 100644 11-Arrays-Bankist/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c70fc154bf06fe84317d8102c219321d07aba317 GIT binary patch literal 6148 zcmeHKJ5Iw;5S)b+k!V6k`7V$mH!xOm0xrNO4I&~E2?d=i&c)F(`)Mpg712bq*1maf zy|b35@OlAQ|G8ZO3jlMvBffo^n%{Sy*i}W0NN0@?UQhVK0n17D?*ZrDV#RBT`w_oq zrFXpHmDP^h!^`e@zu$SfObSQ=DIf);fD|}Gfoi7nn=@*NDg~s#Wh&s`hemho3Wvn_ zba06gfH-3~jQf}+h|L4Uu5d_Xgl0)4Ce>=hu%t8IDz7UX5|a+A;lt|5RuhWF(^07Dg~s#Sb^(2F1-J5=zq-rW0Fo%Knh%x0ybMetb4vv_14MDd9Q8sN4n?y(A~HX o3YTcd#AwGncsss}q|9r+=l!m5NDMmTK_}{Gz;%&Hf&W(E1ic0qN&o-= literal 0 HcmV?d00001 diff --git a/11-Arrays-Bankist/.DS_Store b/11-Arrays-Bankist/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..889e342137c711e8f9b2ea72a6fbdda2db1b4d00 GIT binary patch literal 6148 zcmeHKI|>3p3{6x}u(7n9D|mxJ^aNhOZzl+T`mH>dNAu-_D65s&$O|NICY!gzykfHv z5uIMP6OoaK4B&=xwa_+uZr-v^W)uj=JI=C`!BizR?H zu?a*5ra=V;RddA9pd(+ht|m5tK^M*8L-Sv WHL(eFI`U2j@@K$wp;3WfD{u$f>lLm5 literal 0 HcmV?d00001 diff --git a/11-Arrays-Bankist/starter/script.js b/11-Arrays-Bankist/starter/script.js index 05b54ddf31..d6d80ab3fb 100644 --- a/11-Arrays-Bankist/starter/script.js +++ b/11-Arrays-Bankist/starter/script.js @@ -74,3 +74,21 @@ const currencies = new Map([ const movements = [200, 450, -400, 3000, -650, -130, 70, 1300]; ///////////////////////////////////////////////// + +const displayMovements = function name(movements) { + movements.forEach((num, i) => { + let type = num > 0 ? `deposit` : `withdrawal`; + let str = `
+
2 deposit
+
4 000€
+
+
+
+ 1 withdrawal +
+
-378€
+ `; + }); +}; + +displayMovements(account1.movements); From 70bd920a1781eb76bb1b609f15b8a5c17f438433 Mon Sep 17 00:00:00 2001 From: Createlex Date: Tue, 14 Sep 2021 22:52:17 -0700 Subject: [PATCH 13/13] DisplayFucntio Updated display function --- 11-Arrays-Bankist/starter/script.js | 17 ++++++++--------- 11-Arrays-Bankist/starter/style.css | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/11-Arrays-Bankist/starter/script.js b/11-Arrays-Bankist/starter/script.js index d6d80ab3fb..13e57dd616 100644 --- a/11-Arrays-Bankist/starter/script.js +++ b/11-Arrays-Bankist/starter/script.js @@ -76,18 +76,17 @@ const movements = [200, 450, -400, 3000, -650, -130, 70, 1300]; ///////////////////////////////////////////////// const displayMovements = function name(movements) { + containerMovements.innerHTML = ' '; + movements.forEach((num, i) => { let type = num > 0 ? `deposit` : `withdrawal`; + let str = `
-
2 deposit
-
4 000€
-
-
-
- 1 withdrawal -
-
-378€
- `; +
${type}
+
${num}
+
`; + + containerMovements.insertAdjacentHTML('afterbegin', str); }); }; diff --git a/11-Arrays-Bankist/starter/style.css b/11-Arrays-Bankist/starter/style.css index 05dcf39618..c0d99c650a 100644 --- a/11-Arrays-Bankist/starter/style.css +++ b/11-Arrays-Bankist/starter/style.css @@ -16,7 +16,7 @@ html { } body { - font-family: "Poppins", sans-serif; + font-family: 'Poppins', sans-serif; color: #444; background-color: #f3f3f3; height: 100vh; @@ -94,7 +94,7 @@ nav { gap: 2rem; /* NOTE This creates the fade in/out anumation */ - opacity: 0; + opacity: 100; transition: all 1s; }