From 9d7ab91d3020b9cb038c020f04c0d3e2dac06fa3 Mon Sep 17 00:00:00 2001 From: akbel Date: Thu, 10 Oct 2019 00:06:58 +0200 Subject: [PATCH 01/12] module exercises var-functions-primitive types --- .DS_Store | Bin 0 -> 8196 bytes module-exercises/functions.js | 97 ++++++++++++++-------------- module-exercises/index.html | 35 +++++----- module-exercises/primitive-types.js | 24 +++---- module-exercises/variables.js | 45 +++++++++++-- week-1-project/sort-handler.js | 5 +- 6 files changed, 116 insertions(+), 90 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..7fc857b815426841eadd76788a60d33905d03b96 GIT binary patch literal 8196 zcmeHM-A)rh6g~qe+oG@t2pUZq8xs|Hhy?inMX(?Q3WIRJ&RbV#1+)TM0j+>mKr8S!D1gswo{XP7 z_hqXtwE|j!|55>dKEyC{Oeic%6h{XZA_PEe!fKJw#yCK5VhR%q%Mt|@`;^fGQBwa358{ek`6@DfvAy*icp9c9eFX~4kRH_ms$a>K)nJyc5lImeGMab_lNjB zNVzPRby*fY_@=smx%aC`XaPjw2BcsNuD~rwV>t+`VApV7)o@JoVPNApE{-{X`5|T> za^OIKR?V2Cd$0U#DJZCWew!`0P7n?ay(0~cO$QD(8%ETK9*!=iS6C?>T46CrTK+u0 znzX`|tg@#WbGL0PJLAw&#_SwpUT8TU^#$3nDY`7&aXg!qlC0?2f#@eK8w?|2L^5Xg z=H{96L;bOl(XIa2=DBldj*gt&+KL$6r-v`5mR8p{HXm(0e#XVb14|uj&?c|9%janA zs+*HrQ}ZToD)atenw6PHqAiCGx3-z>M>^U&+q=4scK380JAV8`#_Y&ixd(Zl&tZ(Y z%ul*SI-mC)J6*7Hj+dVe>BBJXY|xB(q{elM+V{R!O|KWwr}KM-=P~n`7KUt64TX&HN!6bMVxzI^YOkez&t+a7eR)3-n8N*c8OHH`cHD>L33^rU-Bu{!Zlieb z12BxafP0YPH#>?uG5m24lh1qM?$iDEOTB7VquTe(ueB9t>dUG#wVFG!3zwg*)m*&P zNh`1i1sbJq50C$^;IX5>1MERO?Wz^nCkl|J@$`5SCsTPTsht;(wPToQKmWx->f)bL;2U5MxKscD literal 0 HcmV?d00001 diff --git a/module-exercises/functions.js b/module-exercises/functions.js index f22570a..13fbc73 100644 --- a/module-exercises/functions.js +++ b/module-exercises/functions.js @@ -174,14 +174,15 @@ function tracing1() { }; // set values in the args to pass the assert - let arg1 = "", arg2 = "", arg3 = ""; + let arg1 = "y", arg2 = "x", arg3 = "z"; let returnval = f(arg1, arg2, arg3); console.assert(returnval === "zyx", "1 a"); - arg1 = "", arg2 = "", arg3 = ""; + arg1 = "z", arg2 = "x", arg3 = "y"; returnval = f(arg1, arg2, arg3); console.assert(returnval === "yzx", "1 b"); + } evaluate(tracing1); @@ -194,11 +195,11 @@ function tracing2() { }; // set values in the args to pass the assert - let arg1 = "", arg2 = "", arg3 = ""; + let arg1 = "x", arg2 = "y", arg3 = "z"; let returnVal = f(arg1, arg3, arg2); console.assert(returnVal === "yxz", "returnVal should be yxz"); - arg1 = "", arg2 = "", arg3 = ""; + arg1 = "y", arg2 = "x", arg3 = "z"; returnVal = f(arg2, arg1, arg3); console.log(returnVal === "zxy", "returnVal should be zxy"); @@ -217,12 +218,12 @@ function tracing3() { }; // set values in the args to pass the assert - let arg1 = "", arg2 = "", arg3 = ""; + let arg1 = "z", arg2 = "x", arg3 = "y"; let returnVal = f(arg1, arg2, arg3); console.assert(returnVal === "yxz", "returnVal should be yxz"); - arg1 = "", arg2 = "", arg3 = ""; + arg1 = "z", arg2 = "y", arg3 = "x"; returnVal = f(arg3, arg2, arg1); console.assert(returnVal === "zyx", "returnVal should be zyx"); @@ -239,11 +240,11 @@ function tracing4() { // pass x, y and z to the function in the right order // don't change their values! let x = "x", y = "y", z = "z"; - let returnVal = f(); + let returnVal = f(x,z,y); console.assert(returnVal === "yxz", "returnVal should be yxz"); x = "x", y = "z", z = "y"; - returnVal = f(); + returnVal = f(z,x,y); console.assert(returnVal === "zyx", "returnVal should be zyx"); } @@ -260,11 +261,11 @@ function tracing5() { // pass x, y and z to the function in the right order // don't change their values! let x = "x", y = "y", z = "z"; - let returnVal = f(); + let returnVal = f(z,x,y); console.assert(returnVal === "xzy", "returnVal should be xzy"); x = "y", y = "x", z = "z"; - returnVal = f(); + returnVal = f(x,z,y); console.assert(returnVal === "zyx", "returnVal should be zyx"); } @@ -275,7 +276,7 @@ function tracing6() { // concatinate the params to pass the tests function f(param1, param2, param3) { - const result = null; + const result = param3 + param1 + param2; return result; }; @@ -295,7 +296,7 @@ function tracing7() { // concatinate the params to pass the tests function f(param1, param2, param3) { - const result = null; + const result = param2 + param3 + param1; return result; }; @@ -314,7 +315,7 @@ evaluate(tracing7); function tracing8() { // arrange the parameters to pass the asserts - function f() { + function f(param3,param2,param1) { var result = param2 + param1 + param3; return result; }; @@ -334,7 +335,7 @@ evaluate(tracing8); function tracing9() { // arrange the parameters to pass the asserts - function f() { + function f(param2,param3,param1) { var result = param1 + param2 + param3; return result; }; @@ -354,21 +355,21 @@ evaluate(tracing9); function tracing10() { // do what needs to be done! - function f() { // <-- +function f(param3,param1,param2,param4) { // <-- var result = param3 + param1 + param2 + param4; return result; }; - let arg1 = "", arg2 = "", arg3 = "", arg4 = ""; // <-- + let arg1 = "x", arg2 = "y", arg3 = "z", arg4 = "w"; // <-- let returnVal = f(arg1, arg2, arg3, arg4); console.assert(returnVal === "xyzw", "returnVal should be xyzw"); arg1 = "z", arg2 = "w", arg3 = "y", arg4 = "x"; returnVal = f(arg3, arg1, arg4, arg2); - console.assert(returnVal === "", "returnVal should be ?"); // <-- + console.assert(returnVal === "yzxw", "returnVal should be ?"); // <-- arg1 = "z", arg2 = "w", arg3 = "y", arg4 = "x"; - returnVal = f(); // <-- + returnVal = f(arg1,arg3,arg2,arg4); // <-- console.assert(returnVal === "zywx", "returnVal should be zywx"); } @@ -431,12 +432,12 @@ evaluate(example2_testCases, exampleTestCases); const writeTestCases1 = [ - { name: 'first', args: [/* what adds to be 5? */], expected: 5 }, - { name: 'second', args: [/* what else adds to be 5? */], expected: 5 }, - { name: 'third', args: [-2, 2], expected: null }, // what return value do you expect? - { name: 'fourth', args: [100, 20], expected: null }, // what return value do you expect? - { name: 'fifth', args: [], expected: null }, // create your own test case! - { name: 'sixth', args: [], expected: null }, // create your own test case! + { name: 'first', args: [0,5], expected: 5 }, + { name: 'second', args: [2,3], expected: 5 }, + { name: 'third', args: [-2, 2], expected: 0 }, // what return value do you expect? + { name: 'fourth', args: [100, 20], expected: 120}, // what return value do you expect? + { name: 'fifth', args: [5,10], expected: 15}, // create your own test case! + { name: 'sixth', args: [-10,20], expected: 10 }, // create your own test case! ]; function functionToTest1(a, b) { const result = a + b; @@ -445,12 +446,12 @@ function functionToTest1(a, b) { evaluate(functionToTest1, writeTestCases1); const writeTestCases2 = [ - { name: 'first', args: [/* what subtracts to be 5? */], expected: 5 }, - { name: 'second', args: [/* what else subtracts to be 5? */], expected: 5 }, - { name: 'third', args: [10, 2], expected: null }, // what return value do you expect? - { name: 'fourth', args: [10, 20], expected: null }, // what return value do you expect? - { name: 'fifth', args: [], expected: null }, // create your own test case! - { name: 'sixth', args: [], expected: null }, // create your own test case! + { name: 'first', args: [/* what subtracts to be 5? */6,1], expected: 5 }, + { name: 'second', args: [/* what else subtracts to be 5? */8,3], expected: 5 }, + { name: 'third', args: [10, 2], expected: 8 }, // what return value do you expect? + { name: 'fourth', args: [10, 20], expected: -10 }, // what return value do you expect? + { name: 'fifth', args: [100,30], expected: 70 }, // create your own test case! + { name: 'sixth', args: [4,2], expected: 2 }, // create your own test case! ]; function functionToTest2(a, b) { const result = a - b; @@ -461,12 +462,12 @@ evaluate(functionToTest2, writeTestCases2); const writeTestCases3 = [ - { name: 'first', args: [/* what multiplies to be 5? */], expected: 5 }, - { name: 'second', args: [/* what else multiplies to be 5? */], expected: 5 }, - { name: 'third', args: [10, 2], expected: null }, // what return value do you expect? - { name: 'fourth', args: [10, 20], expected: null }, // what return value do you expect? - { name: 'fifth', args: [], expected: null }, // create your own test case! - { name: 'sixth', args: [], expected: null }, // create your own test case! + { name: 'first', args: [/* what multiplies to be 5? */1,5], expected: 5 }, + { name: 'second', args: [/* what else multiplies to be 5? */5,1], expected: 5 }, + { name: 'third', args: [10, 2], expected: 20}, // what return value do you expect? + { name: 'fourth', args: [10, 20], expected: 200 }, // what return value do you expect? + { name: 'fifth', args: [4,5], expected: 20 }, // create your own test case! + { name: 'sixth', args: [3,7], expected: 21 }, // create your own test case! ]; function functionToTest3(a, b) { const result = a * b; @@ -477,12 +478,12 @@ evaluate(functionToTest3, writeTestCases3); const writeTestCases4 = [ - { name: 'first', args: [/* what letters in what order will return "zyx"? */], expected: 'zyx' }, - { name: 'second', args: [/* what letters in what order will return "yzx"? */], expected: 'yzx' }, - { name: 'third', args: ['y', 'z', 'x'], expected: null }, // what return value do you expect? - { name: 'fourth', args: ['x', 'y', 'z'], expected: null }, // what return value do you expect? - { name: 'fifth', args: [], expected: null }, // create your own test case! - { name: 'sixth', args: [], expected: null }, // create your own test case! + { name: 'first', args: [/* what letters in what order will return "zyx"? */y,x,z], expected: 'zyx' }, + { name: 'second', args: [/* what letters in what order will return "yzx"? */z,x,y], expected: 'yzx' }, + { name: 'third', args: ['y', 'z', 'x'], expected: xyz }, // what return value do you expect? + { name: 'fourth', args: ['x', 'y', 'z'], expected: zxy }, // what return value do you expect? + { name: 'fifth', args: [z,y,x], expected: xzy }, // create your own test case! + { name: 'sixth', args: [x,z,y], expected: yxz }, // create your own test case! ]; function functionToTest4(a, b, c) { const result = c + a + b; @@ -493,12 +494,12 @@ evaluate(functionToTest4, writeTestCases4); const writeTestCases5 = [ - { name: 'first', args: [/* what letters in what order will return "zyx"? */], expected: 'zyx' }, - { name: 'second', args: [/* what letters in what order will return "yzx"? */], expected: 'yzx' }, - { name: 'third', args: ['y', 'z', 'x'], expected: null }, // what return value do you expect? - { name: 'fourth', args: ['x', 'y', 'z'], expected: null }, // what return value do you expect? - { name: 'fifth', args: [], expected: null }, // create your own test case! - { name: 'sixth', args: [], expected: null }, // create your own test case! + { name: 'first', args: [/* what letters in what order will return "zyx"? */x,z,y], expected: 'zyx' }, + { name: 'second', args: [/* what letters in what order will return "yzx"? */x,y,z], expected: 'yzx' }, + { name: 'third', args: ['y', 'z', 'x'], expected: zxy }, // what return value do you expect? + { name: 'fourth', args: ['x', 'y', 'z'], expected: yzx }, // what return value do you expect? + { name: 'fifth', args: [z,y,x], expected: yxz }, // create your own test case! + { name: 'sixth', args: [y,x,z], expected: xzy }, // create your own test case! ]; function functionToTest5(a, b, c) { const result = b + c + a; diff --git a/module-exercises/index.html b/module-exercises/index.html index 2ef651b..95f7f08 100644 --- a/module-exercises/index.html +++ b/module-exercises/index.html @@ -1,27 +1,27 @@ - + + + - - + understand javascript + - understand javascript - + + - - + + how to work with these exercises - - - how to work with these exercises - - - - + + @@ -37,9 +37,6 @@ - - challenge exercises - - - + challenge exercises + diff --git a/module-exercises/primitive-types.js b/module-exercises/primitive-types.js index 2ab5eb0..8a3d08e 100644 --- a/module-exercises/primitive-types.js +++ b/module-exercises/primitive-types.js @@ -59,27 +59,27 @@ evaluate(example_allValuesHaveAType); // the type of a value is very important to understanding how JS works const typeofTests = [ // boolean values - { name: 'boo, true', args: [true], expected: '' }, - { name: 'boo, false', args: [false], expected: '' }, + { name: 'boo, true', args: [true], expected: 'boolean' }, + { name: 'boo, false', args: [false], expected: 'boolean' }, // null's type is 'null'. just remember, don't try yet to understand - { name: 'obj, true', args: [null], expected: '' }, + { name: 'obj, true', args: [null], expected: 'null' }, // undefined. like with null, there is only one value with this type - { name: 'und, undefined', args: [undefined], expected: '' }, + { name: 'und, undefined', args: [undefined], expected: 'undefined' }, // strings are anything with quotes around it - { name: 'str, ', args: [''], expected: '' }, - { name: 'str, anything with quotes!', args: ['anything with quotes!'], expected: '' }, + { name: 'str, ', args: [''], expected: 'string' }, + { name: 'str, anything with quotes!', args: ['anything with quotes!'], expected: 'string' }, // numbers are a bit more strange and varied { name: 'num, 0.0', args: [0.0], expected: 'number' }, { name: 'num, NaN', args: [NaN], expected: 'number' }, { name: 'num, Infinity', args: [Infinity], expected: 'number' }, { name: 'num, 4', args: [4], expected: 'number' }, // write 6 more passing test cases with expected value 'number' - { name: '', args: null, expected: null }, - { name: '', args: null, expected: null }, - { name: '', args: null, expected: null }, - { name: '', args: null, expected: null }, - { name: '', args: null, expected: null }, - { name: '', args: null, expected: null }, + { name: 'num, 1', args: [1], expected: number }, + { name: 'num, 5', args: [5], expected: number }, + { name: 'num, Nan', args: [NaN], expected: number }, + { name: 'num, infinity', args: [Infinity], expected: number }, + { name: 'num, 1.1', args: [1.1], expected: number }, + { name: 'num, -2', args: [-2], expected: number }, ] function allValuesHaveAType(value) { return typeof value; diff --git a/module-exercises/variables.js b/module-exercises/variables.js index 0ed91de..af5adde 100644 --- a/module-exercises/variables.js +++ b/module-exercises/variables.js @@ -82,7 +82,10 @@ function threeVariableSwap1() { let temp = ''; // can be done in 4 lines - + temp=a; + a=b; + b=c; + c=temp; console.assert(a === "a", "a should store 'a'"); console.assert(b === "b", "b should store 'b'"); @@ -96,7 +99,11 @@ function threeVariableSwap2() { let temp = ''; // can be done in 4 lines - + + temp=a; + a=c; + c=b; + b=temp console.assert(a === "a", "a should store 'a'"); console.assert(b === "b", "b should store 'b'"); @@ -110,7 +117,11 @@ function fourVariableSwap1() { let temp = ''; // can be done in 5 lines - + temp=a; + a=b; + b=c; + c=d; + d=temp; console.assert(a === "a", "a should store 'a'"); console.assert(b === "b", "b should store 'b'"); @@ -125,6 +136,13 @@ function fourVariableSwap2() { let temp = ''; // can be done in 6 lines + temp=a + a=d + d=temp + temp=c + c=b + b=temp + console.assert(a === "w", "a should store 'w'"); @@ -141,6 +159,13 @@ function fiveVariableSwap() { // can be done in 6 lines + temp=a + a=e + e=temp + temp=b + b=d + d=temp + console.assert(a === "v", "a should store 'v'"); console.assert(b === "w", "b should store 'w'"); @@ -190,7 +215,7 @@ function multipleAssignments1() { // can be done in 1 line - + temp=a,a=b,b=c,c=temp; console.assert(a === "a", "a should store 'a'"); console.assert(b === "b", "b should store 'b'"); console.assert(c === "c", "c should store 'c'"); @@ -204,7 +229,7 @@ function multipleAssignments2() { // can be done in 1 line - + temp=a,a=c,c=b,b=temp; console.assert(a === "a", "a should store 'a'"); console.assert(b === "b", "b should store 'b'"); console.assert(c === "c", "c should store 'c'"); @@ -217,7 +242,7 @@ function multipleAssignments3() { let temp = ''; // can be done in 1 line - + temp=a,a=b,b=c,c=d,d=temp; console.assert(a === "a", "a should store 'a'"); console.assert(b === "b", "b should store 'b'"); @@ -233,7 +258,7 @@ function multipleAssignments4() { // can be done in 1 line - + temp=a,a=d,d=temp,temp=b,b=c,c=temp; console.assert(a === "w", "a should store 'w'"); console.assert(b === "x", "b should store 'x'"); console.assert(c === "y", "c should store 'y'"); @@ -270,6 +295,11 @@ function chainedAssignments1() { // can be done in 3 lines or less + temp=b; +b=a1; +a1=a2=temp; + + console.assert(a1 === "a", 'a1 should store "a"'); console.assert(a1 === a2, 'a1 should store the same value as a2'); console.assert(b === "b", 'b should store "b"'); @@ -286,6 +316,7 @@ function chainedAssignments2() { // can be done in 4 lines or less + temp=a,a=b1,b1=b2=c1,c1=c2=c3=temp; console.assert(a === "a", 'a should store "a"'); diff --git a/week-1-project/sort-handler.js b/week-1-project/sort-handler.js index e45575f..06e56a0 100644 --- a/week-1-project/sort-handler.js +++ b/week-1-project/sort-handler.js @@ -1,14 +1,11 @@ /* - write a little javascript to: - take in the string 'toSort' - sort all of the characters by charCode number - and assign the new string to 'sorted' - the handler is already set up to: - read user input to the variable 'toSort' - write 'sorted' to the output - */ @@ -29,4 +26,4 @@ function sortHandler() { console.log('sorted:', typeof sorted, ',', sorted); }; const sortButton = document.getElementById('sort-button'); -sortButton.addEventListener('click', sortHandler); +sortButton.addEventListener('click', sortHandler); \ No newline at end of file From fc622f184a0efd84b14d8279b64e92db7711f26c Mon Sep 17 00:00:00 2001 From: akbel Date: Thu, 10 Oct 2019 00:44:23 +0200 Subject: [PATCH 02/12] head-header-sections-footer --- week-1-project/index.html | 153 +++++++++++++++++++++++++------------- 1 file changed, 101 insertions(+), 52 deletions(-) diff --git a/week-1-project/index.html b/week-1-project/index.html index 9397ef9..d8da27b 100644 --- a/week-1-project/index.html +++ b/week-1-project/index.html @@ -1,55 +1,104 @@ - + - - - - - week 1 project - - - - - - - - -
-
-
-

-  
- - -
-
-
-

-  
- -
-
-
-

-  
- - -
-
-
-
-

-  
- - - - - - - - - - - - + + + + welcome to javascript Akbel + + + +
+

TYPE AND SEE

+

+ Would you like to play a silly game and could not deside what it is? +
+ Than this site is for you, Type and Enjoy! +

+ +
+ + +
+ You can type anything you like in the box below. It will sort your entry + alfabetically. + +
+ +
+
+

+      
+
+ +
+ You can type anything you like in the box below. It will reverse your entry. Try to read it aloud! +
+ +
+
+

+      
+
+ +
+ You can type anything you like in the box below. It will shrink your entry by deleting all the wovels. + Do you remember the times when there is no internet in your phone and messages were so expensive. + So that you had to type without wovels and also understand what your friend has written to you. + If you don't remember or did not experience it, you should definetly try it! +
+ +
+
+

+      
+
+ +
+ You can type anything you like in the box below. It is a version of Parrot. Just repeats what you say. + Then don't afraid to say it, I LOVE YOU and I Believe You, You Can Do It! +
+ +
+ +
+
+

+      
+
+ + + + + + +
JavasSript first week homework, Akbel 2019
+ From 9ca15bdeb67647d425836f7cd7398d72a15da9b4 Mon Sep 17 00:00:00 2001 From: akbel Date: Thu, 10 Oct 2019 00:55:31 +0200 Subject: [PATCH 03/12] sort handler-sorted alfabeticly --- week-1-project/sort-handler.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/week-1-project/sort-handler.js b/week-1-project/sort-handler.js index 06e56a0..07ee36e 100644 --- a/week-1-project/sort-handler.js +++ b/week-1-project/sort-handler.js @@ -14,8 +14,13 @@ function sortHandler() { // read and process user input (this works, no need to change it!) const toSort = document.getElementById('sort-input').value; - // pass user input through core logic (write this! it doesn't work) - const sorted = `sort the charecters in ${toSort}`; + // pass user input through core logic (write this! it doesn't work) + +    function forReverse(){ +    return toReverse.split('').reverse().join(''); +    }; +    const reversed = forReverse() ; + // report result to user (this works, no need to change it!) const outputField = document.getElementById('sort-output'); From a1017beddb9e141b9babe29217ea166dbfed37fa Mon Sep 17 00:00:00 2001 From: akbel Date: Thu, 10 Oct 2019 00:57:20 +0200 Subject: [PATCH 04/12] sort handler- sorted alphabetically/correction --- week-1-project/sort-handler.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/week-1-project/sort-handler.js b/week-1-project/sort-handler.js index 07ee36e..847eb79 100644 --- a/week-1-project/sort-handler.js +++ b/week-1-project/sort-handler.js @@ -14,13 +14,12 @@ function sortHandler() { // read and process user input (this works, no need to change it!) const toSort = document.getElementById('sort-input').value; - // pass user input through core logic (write this! it doesn't work) - -    function forReverse(){ -    return toReverse.split('').reverse().join(''); -    }; -    const reversed = forReverse() ; - +// pass user input through core logic (write this! it doesn't work) +   +  function sortArray() {  +  return toSort.split('').sort().join(''); +  } +  const sorted =sortArray(); // report result to user (this works, no need to change it!) const outputField = document.getElementById('sort-output'); From 042b8eb355e2177ab1a4f27c96b901b2899e24bb Mon Sep 17 00:00:00 2001 From: akbel Date: Thu, 10 Oct 2019 01:02:30 +0200 Subject: [PATCH 05/12] reverse handler --- week-1-project/reverse-handler.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/week-1-project/reverse-handler.js b/week-1-project/reverse-handler.js index 6682c5f..6565647 100644 --- a/week-1-project/reverse-handler.js +++ b/week-1-project/reverse-handler.js @@ -17,9 +17,14 @@ function reverseHandler() { // read and process user input (this works, no need to change it!) const toReverse = document.getElementById('reverse-input').value; - // pass user input through core logic (write this! it doesn't work) - const reversed = `reverse ${toReverse}`; - + // pass user input through core logic (write this! it doesn't work) + +   function forReverse(){ +    return toReverse.split('').reverse().join(''); +    }; +    const reversed = forReverse() ; +   + // report result to user (this works, no need to change it!) const outputField = document.getElementById('reverse-output'); outputField.innerHTML = reversed; From d7593721a47ccd6c21f105f360e922e71c2f1e2c Mon Sep 17 00:00:00 2001 From: akbel Date: Thu, 10 Oct 2019 10:42:00 +0200 Subject: [PATCH 06/12] devowel handler (only english vowels and two others) --- week-1-project/devowel-handler.js | 29 +++++++++++++++++++---------- week-1-project/index.html | 18 +++++++++++------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/week-1-project/devowel-handler.js b/week-1-project/devowel-handler.js index c50d2d2..a96be7f 100644 --- a/week-1-project/devowel-handler.js +++ b/week-1-project/devowel-handler.js @@ -12,20 +12,29 @@ the handler is already set up to: */ function devowelHandler() { - // read and process user input (this works, no need to change it!) - const toDevowel = document.getElementById('devowel-input').value; + const toDevowel = document.getElementById("devowel-input").value; // pass user input through core logic (write this! it doesn't work) - const devoweled = `remove all vowels from ${toDevowel}`; + function wegvowels() { + const vowels = ["a", "e", "o",'ø', "i", "u", "ü"]; + return toDevowel + .split("") + .filter(function(wv) { + return vowels.indexOf(wv.toLowerCase()) == -1; + }) + .join(""); + } + const devoweled = wegvowels(); + // report result to user (this works, no need to change it!) - const outputField = document.getElementById('devowel-output'); + const outputField = document.getElementById("devowel-output"); outputField.innerHTML = devoweled; - console.log('\n--- devowelHandler ---'); - console.log('toDevowel:', typeof toDevowel, ',', toDevowel); - console.log('devoweled:', typeof devoweled, ',', devoweled); -}; -const devowelButton = document.getElementById('devowel-button'); -devowelButton.addEventListener('click', devowelHandler); + console.log("\n--- devowelHandler ---"); + console.log("toDevowel:", typeof toDevowel, ",", toDevowel); + console.log("devoweled:", typeof devoweled, ",", devoweled); +} +const devowelButton = document.getElementById("devowel-button"); +devowelButton.addEventListener("click", devowelHandler); diff --git a/week-1-project/index.html b/week-1-project/index.html index d8da27b..a68b398 100644 --- a/week-1-project/index.html +++ b/week-1-project/index.html @@ -29,7 +29,7 @@

TYPE AND SEE

You can type anything you like in the box below. It will sort your entry alfabetically. - +
TYPE AND SEE

       
- +
You can type anything you like in the box below. It will reverse your entry. Try to read it aloud! +
TYPE AND SEE

       
- +
You can type anything you like in the box below. It will shrink your entry by deleting all the wovels. Do you remember the times when there is no internet in your phone and messages were so expensive. So that you had to type without wovels and also understand what your friend has written to you. If you don't remember or did not experience it, you should definetly try it! -
+
+
TYPE AND SEE

       
- +
You can type anything you like in the box below. It is a version of Parrot. Just repeats what you say. Then don't afraid to say it, I LOVE YOU and I Believe You, You Can Do It! -
+
+ +
TYPE AND SEE

       
- + From f35e3c7f09b91ddcf5c75b025df0e529a834cfb2 Mon Sep 17 00:00:00 2001 From: akbel Date: Fri, 11 Oct 2019 17:43:21 +0200 Subject: [PATCH 07/12] repeat handler (not succesfull) and css --- .DS_Store | Bin 8196 -> 8196 bytes week-1-project/index.html | 151 +++++++++++++++++-------------- week-1-project/repeat-handler.js | 28 +++--- week-1-project/style.css | 91 +++++++++++++++++++ 4 files changed, 188 insertions(+), 82 deletions(-) diff --git a/.DS_Store b/.DS_Store index 7fc857b815426841eadd76788a60d33905d03b96..e7a806258c38fea19a5230bdfe121bf3a9a37787 100644 GIT binary patch delta 18 ZcmZp1XmQx^N`%$iKu5uJ^Lr6dZU8?+1^NI0 delta 16 XcmZp1XmQx^N@Q}Dp!;S+(aT%_I&21F diff --git a/week-1-project/index.html b/week-1-project/index.html index a68b398..e784d39 100644 --- a/week-1-project/index.html +++ b/week-1-project/index.html @@ -2,34 +2,44 @@ - - welcome to javascript Akbel - + + + + + + + +
-

TYPE AND SEE

-

- Would you like to play a silly game and could not deside what it is? -
- Than this site is for you, Type and Enjoy! -

+
+

TYPE AND SEE

+

+ Would you like to play a silly game and could not deside what it is? +
+ Then this site is for you, Type and Enjoy! +

+
-
+
You can type anything you like in the box below. It will sort your entry - alfabetically. -
+ according to charCode. +
TYPE AND SEE

       
- + -
- You can type anything you like in the box below. It will reverse your entry. Try to read it aloud! -
-
- -
-
-

-      
- +
+ You can type anything you like in the box below. It will reverse your + entry. Try to read it aloud! +
+
+ +
+
+

+    
-
- You can type anything you like in the box below. It will shrink your entry by deleting all the wovels. - Do you remember the times when there is no internet in your phone and messages were so expensive. - So that you had to type without wovels and also understand what your friend has written to you. - If you don't remember or did not experience it, you should definetly try it! -
-
- -
-
-

-      
- +
+ You can type anything you like in the box below. It will shrink your entry + by deleting all the wovels. Do you remember the times when there is no + internet in your phone and messages were so expensive. So that you had to + type without wovels and also understand what your friend has written to + you. If you don't remember or did not experience it, you should definetly + try it! +
+
+ +
+
+

+    
-
- You can type anything you like in the box below. It is a version of Parrot. Just repeats what you say. - Then don't afraid to say it, I LOVE YOU and I Believe You, You Can Do It! -
- -
- -
- -
-
-

-      
- +
+ You can type anything you like in the box below. It is a version of + Parrot. Just repeats what you say. Then don't afraid to say it, I LOVE YOU + and I Believe You, You Can Do It! +
+ +
+ +
+ +
+
+

+    
diff --git a/week-1-project/repeat-handler.js b/week-1-project/repeat-handler.js index d0c5d72..2a70508 100644 --- a/week-1-project/repeat-handler.js +++ b/week-1-project/repeat-handler.js @@ -13,27 +13,31 @@ the handler is already set up to: */ function repeatHandler() { - // read and process user input (this works, no need to change it!) - const strToRepeat = document.getElementById('repeat-string-input').value; + const strToRepeat = document.getElementById("repeat-string-input").value; - const rawNumInput = document.getElementById('repeat-number-input').value; + const rawNumInput = document.getElementById("repeat-number-input").value; const numOfRepetitions = Number(rawNumInput); if (numOfRepetitions !== numOfRepetitions) { throw new TypeError('second input to "repeat it" must be a number'); } - // pass user input through core logic (write this! it doesn't work) - const repeated = `repeat ${strToRepeat} ${numOfRepetitions} times`; + + function toRepeat(strToRepeat, numOfRepetitions) { + if (numOfRepetitions < 0) return ""; + if (numOfRepetitions === 1) return strToRepeat; + else return strToRepeat + toRepeat(strToRepeat, numOfRepetitions - 1); + } + const repeated = toRepeat(); // report result to user (this works, no need to change it!) - const outputField = document.getElementById('repeat-output'); + const outputField = document.getElementById("repeat-output"); outputField.innerHTML = repeated; - console.log('\n--- repeatHandler ---'); - console.log('strToRepeat:', typeof strToRepeat, ',', strToRepeat); - console.log('repeated:', typeof repeated, ',', repeated); -}; -const repeatButton = document.getElementById('repeat-button'); -repeatButton.addEventListener('click', repeatHandler); + console.log("\n--- repeatHandler ---"); + console.log("strToRepeat:", typeof strToRepeat, ",", strToRepeat); + console.log("repeated:", typeof repeated, ",", repeated); +} +const repeatButton = document.getElementById("repeat-button"); +repeatButton.addEventListener("click", repeatHandler); diff --git a/week-1-project/style.css b/week-1-project/style.css index e69de29..834cb59 100644 --- a/week-1-project/style.css +++ b/week-1-project/style.css @@ -0,0 +1,91 @@ +body{ + font-family: 'Dosis', sans-serif; + background-color:#f2ad9f; + margin:0; + padding:0; + color:#323339; + text-align: center; + width: 80%; + } + + +header{ + text-align: center; + font: 30px; + margin: 20px; + padding-top:30px; + padding-bottom: 30px; + min-height:80px; + color: #6cbf84 + + } + .box { + max-width: 600px; + text-align: center; + margin: auto; + margin-top: 25px; + margin-bottom: 25px; + } + ul{ + margin:0; + padding:0; + } + + .colored {color: #f26968} + + header a{ + color:#dfe2d2; + text-decoration:none; + text-transform: uppercase; + font-size:12px; + + } + + header li{ + float:right; + padding: 0 10px 0 10px; + display: inline; + } + + button { + background-color: #6cbf84; + border: none; + height: 30px; + width: 400px; + color: #dfe2d2; + margin: 5px; + font-size: 18px; + } + + button:hover { + background-color: #323339; + } + + input { + color: #323339; + font-size: 14px; + } + + footer{ + padding:20px; + background-color:#dfe2d2; + color:#f2ad9f; + margin-top:20px; + text-align: center; + bottom: 0; + width: 100%; + } + + + @media (max-width: 680px) { + .box { + max-width: 400px; + text-align: center; + margin: auto; + margin-top: 10px; + padding: 10px; + } + + body { + font-size: 0.8em; + } \ No newline at end of file From 5db4a5eb7ea85c41027efc1ce7f985f4cf4ab651 Mon Sep 17 00:00:00 2001 From: akbel <54626312+akbelcolak@users.noreply.github.com> Date: Fri, 11 Oct 2019 17:52:39 +0200 Subject: [PATCH 08/12] Rename week-1-project/README.md to week-1-project/https:/akbelcolak.github.io/javascript-1/tree/master/week-1-project --- .../akbelcolak.github.io/javascript-1/tree/master/week-1-project} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename week-1-project/{README.md => https:/akbelcolak.github.io/javascript-1/tree/master/week-1-project} (100%) diff --git a/week-1-project/README.md b/week-1-project/https:/akbelcolak.github.io/javascript-1/tree/master/week-1-project similarity index 100% rename from week-1-project/README.md rename to week-1-project/https:/akbelcolak.github.io/javascript-1/tree/master/week-1-project From ed592bd1065b38e97f9ac211745ee7de6b6e29ae Mon Sep 17 00:00:00 2001 From: akbel <54626312+akbelcolak@users.noreply.github.com> Date: Fri, 11 Oct 2019 17:53:14 +0200 Subject: [PATCH 09/12] Rename week-1-project/https:/akbelcolak.github.io/javascript-1/tree/master/week-1-project to week-1-project/https:/akbelcolak.github.io/readme.md --- .../{javascript-1/tree/master/week-1-project => readme.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename week-1-project/https:/akbelcolak.github.io/{javascript-1/tree/master/week-1-project => readme.md} (100%) diff --git a/week-1-project/https:/akbelcolak.github.io/javascript-1/tree/master/week-1-project b/week-1-project/https:/akbelcolak.github.io/readme.md similarity index 100% rename from week-1-project/https:/akbelcolak.github.io/javascript-1/tree/master/week-1-project rename to week-1-project/https:/akbelcolak.github.io/readme.md From ed4b9b222619919dd71c5312035934ed9ca16f07 Mon Sep 17 00:00:00 2001 From: akbel Date: Mon, 14 Oct 2019 22:18:31 +0200 Subject: [PATCH 10/12] exercises done in the class --- .DS_Store | Bin 8196 -> 8196 bytes module-exercises/explicit-coercion.js | 26 ++++++------- module-exercises/functions.js | 24 ++++++------ module-exercises/index.html | 28 ++++++------- module-exercises/primitive-types.js | 54 +++++++++++++------------- module-exercises/variables.js | 4 +- week-1-project/repeat-handler.js | 4 +- week-1-project/style.css | 5 +++ week-2-project/.DS_Store | Bin 0 -> 6148 bytes week-2-project/javascript-1 | 1 + 10 files changed, 77 insertions(+), 69 deletions(-) create mode 100644 week-2-project/.DS_Store create mode 160000 week-2-project/javascript-1 diff --git a/.DS_Store b/.DS_Store index e7a806258c38fea19a5230bdfe121bf3a9a37787..261421fa57a845532ac03cbf266fac1603426403 100644 GIT binary patch delta 279 zcmZp1XmOa}&&aniU^hP_-)0_xIL67ZMBFED6x3ndJo%oWGKZ*`xTu7rl;mVip(5FM z0si9TqWqkkfc)ajlFawdWPK$Cm8NB zyl42y$j&IhsKltvXu@dAXwT@u=*j5K7{D0F7zNSJ#0a4oWS}&ZVvL@=PEcj@0pX{N klQTsHCr61q2Gf3`(wmox`Z8{2m-xmqnL~6g7FjPw03pOk%K!iX delta 299 zcmZp1XmOa}&&abeU^hP_&t@KhI7U`W104n9$qr&plcxwP@?<8L6(r^4CowQE?wfp1 zP?bb3){iho*KacW6qya0c3a#4OxPC$NfW=Up#-sBlVzS1Dk zjQn!XjM|JQjJAySj2?`Ej6sYcjFF5{ zjL{JNOpH)-WT7;aVoU)t1Q>D|@);J-5@y=GOU##XV}mH;W_F2hER+4j946a|2u_|a OCOtV$)CMXm#0UT(07x|e diff --git a/module-exercises/explicit-coercion.js b/module-exercises/explicit-coercion.js index d6bcfd4..d541a34 100644 --- a/module-exercises/explicit-coercion.js +++ b/module-exercises/explicit-coercion.js @@ -23,12 +23,12 @@ // fix the test cases' expected values to pass the function const StringTests = [ // string values remain unchanged - { name: 'str, any string', args: ['any string'], expected: null }, + { name: 'str, any string', args: ['any string'], expected: 'any string' }, // casting with String just puts quotes around a thing - { name: 'num, 3', args: [3], expected: null }, - { name: 'boo, true', args: [true], expected: null }, - { name: 'obj, null', args: [null], expected: null }, - { name: 'und, undefined', args: [undefined], expected: null }, + { name: 'num, 3', args: [3], expected: '3' }, + { name: 'boo, true', args: [true], expected: 'true' }, + { name: 'obj, null', args: [null], expected: 'null' }, + { name: 'und, undefined', args: [undefined], expected: 'undefined' }, // write at least 5 more test cases for the String function ]; String.quizzing = true; @@ -45,11 +45,11 @@ const NumberTests = [ { name: 'num, Infinity', args: [Infinity], expected: Infinity }, { name: 'num, NaN', args: [NaN], expected: NaN }, // true and false, the only boolean values - { name: 'boo, true', args: [true], expected: 0 }, - { name: 'boo, false', args: [false], expected: 1 }, + { name: 'boo, true', args: [true], expected: 1 }, + { name: 'boo, false', args: [false], expected: 0 }, // null & undefined - { name: 'obj, null', args: [null], expected: NaN }, - { name: 'und, undefined', args: [undefined], expected: 0 }, + { name: 'obj, null', args: [null], expected: 0 }, + { name: 'und, undefined', args: [undefined], expected: NaN }, // strings are bit more interesting, write 7 more test cases with string args { name: 'str, undefined', args: ['undefined'], expected: NaN }, { name: 'str, Infinity', args: ['Infinity'], expected: Infinity }, @@ -68,13 +68,13 @@ const BooleanTests = [ { name: 'boo, false', args: [false], expected: false }, // anything but 0 & NaN is cast to true { name: 'num, 3', args: [3], expected: true }, - { name: 'num, 0', args: [0], expected: true }, + { name: 'num, 0', args: [0], expected: false }, { name: 'num, 1e3', args: [1000], expected: true }, - { name: 'num, Infinity', args: [Infinity], expected: false }, + { name: 'num, Infinity', args: [Infinity], expected: true }, { name: 'num, NaN', args: [NaN], expected: false }, // null & undefined - { name: 'obj, null', args: [null], expected: true }, - { name: 'und, undefined', args: [undefined], expected: true }, + { name: 'obj, null', args: [null], expected: false }, + { name: 'und, undefined', args: [undefined], expected: false }, // anything but an empty string is cast to true { name: 'str, undefined', args: ['undefined'], expected: false }, { name: 'str, false', args: ['false'], expected: false }, diff --git a/module-exercises/functions.js b/module-exercises/functions.js index 13fbc73..b573bd4 100644 --- a/module-exercises/functions.js +++ b/module-exercises/functions.js @@ -478,12 +478,12 @@ evaluate(functionToTest3, writeTestCases3); const writeTestCases4 = [ - { name: 'first', args: [/* what letters in what order will return "zyx"? */y,x,z], expected: 'zyx' }, - { name: 'second', args: [/* what letters in what order will return "yzx"? */z,x,y], expected: 'yzx' }, - { name: 'third', args: ['y', 'z', 'x'], expected: xyz }, // what return value do you expect? - { name: 'fourth', args: ['x', 'y', 'z'], expected: zxy }, // what return value do you expect? - { name: 'fifth', args: [z,y,x], expected: xzy }, // create your own test case! - { name: 'sixth', args: [x,z,y], expected: yxz }, // create your own test case! + { name: 'first', args: [/* what letters in what order will return "zyx"? */'y','x','z'], expected: 'zyx' }, + { name: 'second', args: [/* what letters in what order will return "yzx"? */'z','x','y'], expected: 'yzx' }, + { name: 'third', args: ['y', 'z', 'x'], expected: 'xyz' }, // what return value do you expect? + { name: 'fourth', args: ['x', 'y', 'z'], expected: 'zxy' }, // what return value do you expect? + { name: 'fifth', args: ['z','y','x'], expected: 'xzy' }, // create your own test case! + { name: 'sixth', args: ['x','z','y'], expected: 'yxz' }, // create your own test case! ]; function functionToTest4(a, b, c) { const result = c + a + b; @@ -494,12 +494,12 @@ evaluate(functionToTest4, writeTestCases4); const writeTestCases5 = [ - { name: 'first', args: [/* what letters in what order will return "zyx"? */x,z,y], expected: 'zyx' }, - { name: 'second', args: [/* what letters in what order will return "yzx"? */x,y,z], expected: 'yzx' }, - { name: 'third', args: ['y', 'z', 'x'], expected: zxy }, // what return value do you expect? - { name: 'fourth', args: ['x', 'y', 'z'], expected: yzx }, // what return value do you expect? - { name: 'fifth', args: [z,y,x], expected: yxz }, // create your own test case! - { name: 'sixth', args: [y,x,z], expected: xzy }, // create your own test case! + { name: 'first', args: [/* what letters in what order will return "zyx"? */'x','z','y'], expected: 'zyx' }, + { name: 'second', args: [/* what letters in what order will return "yzx"? */'x','y','z'], expected: 'yzx' }, + { name: 'third', args: ['y', 'z', 'x'], expected: 'zxy' }, // what return value do you expect? + { name: 'fourth', args: ['x', 'y', 'z'], expected: 'yzx' }, // what return value do you expect? + { name: 'fifth', args: ['z','y','x'], expected: 'yxz' }, // create your own test case! + { name: 'sixth', args: ['y','x','z'], expected: 'xzy' }, // create your own test case! ]; function functionToTest5(a, b, c) { const result = b + c + a; diff --git a/module-exercises/index.html b/module-exercises/index.html index 95f7f08..b622a93 100644 --- a/module-exercises/index.html +++ b/module-exercises/index.html @@ -22,20 +22,20 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + challenge exercises diff --git a/module-exercises/primitive-types.js b/module-exercises/primitive-types.js index 8a3d08e..9653dcd 100644 --- a/module-exercises/primitive-types.js +++ b/module-exercises/primitive-types.js @@ -62,7 +62,7 @@ const typeofTests = [ { name: 'boo, true', args: [true], expected: 'boolean' }, { name: 'boo, false', args: [false], expected: 'boolean' }, // null's type is 'null'. just remember, don't try yet to understand - { name: 'obj, true', args: [null], expected: 'null' }, + { name: 'obj, true', args: [null], expected: 'object' }, // undefined. like with null, there is only one value with this type { name: 'und, undefined', args: [undefined], expected: 'undefined' }, // strings are anything with quotes around it @@ -74,12 +74,12 @@ const typeofTests = [ { name: 'num, Infinity', args: [Infinity], expected: 'number' }, { name: 'num, 4', args: [4], expected: 'number' }, // write 6 more passing test cases with expected value 'number' - { name: 'num, 1', args: [1], expected: number }, - { name: 'num, 5', args: [5], expected: number }, - { name: 'num, Nan', args: [NaN], expected: number }, - { name: 'num, infinity', args: [Infinity], expected: number }, - { name: 'num, 1.1', args: [1.1], expected: number }, - { name: 'num, -2', args: [-2], expected: number }, + { name: 'num, 1', args: [1], expected: 'number'}, + { name: 'num, 5', args: [5], expected: 'number' }, + { name: 'num, Nan', args: [NaN], expected: 'number' }, + { name: 'num, infinity', args: [Infinity], expected: 'number' }, + { name: 'num, 1.1', args: [1.1], expected: 'number' }, + { name: 'num, -2', args: [-2], expected: 'number' }, ] function allValuesHaveAType(value) { return typeof value; @@ -125,16 +125,16 @@ evaluate(example_aBitAboutNaN); // fix the expected values to pass the tests const strictEqualityTests = [ - { name: 'NaN', args: [NaN, NaN], expected: null }, - { name: 'first', args: [true, 'true'], expected: null }, - { name: 'second', args: [1, '1'], expected: null }, - { name: 'third', args: ['1', '1'], expected: null }, - { name: 'fourth', args: [1000, 1e3], expected: null }, - { name: 'fifth', args: [+0, -0], expected: null }, - { name: 'sixth', args: [1, 1.0], expected: null }, - { name: 'seventh', args: ['', ""], expected: null }, - { name: 'eighth', args: ["", ``], expected: null }, - { name: 'ninth', args: [' ', ' '], expected: null }, + { name: 'NaN', args: [NaN, NaN], expected: false }, + { name: 'first', args: [true, 'true'], expected: false }, + { name: 'second', args: [1, '1'], expected: false }, + { name: 'third', args: ['1', '1'], expected: true }, + { name: 'fourth', args: [1000, 1e3], expected: true }, + { name: 'fifth', args: [+0, -0], expected: true }, + { name: 'sixth', args: [1, 1.0], expected: true }, + { name: 'seventh', args: ['', ""], expected: true }, + { name: 'eighth', args: ["", ``], expected: true }, + { name: 'ninth', args: [' ', ' '], expected: false }, ]; function strictEquality(a, b) { // if type OR value are not the same, returns false @@ -147,16 +147,16 @@ evaluate(strictEquality, strictEqualityTests); const strictInequalityTests = [ - { name: 'NaN', args: [NaN, NaN], expected: null }, - { name: 'first', args: [true, 'true'], expected: null }, - { name: 'second', args: [1, '1'], expected: null }, - { name: 'third', args: ['1', '1'], expected: null }, - { name: 'fourth', args: [1000, 1e3], expected: null }, - { name: 'fifth', args: [+0, -0], expected: null }, - { name: 'sixth', args: [1, 1.0], expected: null }, - { name: 'seventh', args: ['', ""], expected: null }, - { name: 'eighth', args: ["", ``], expected: null }, - { name: 'ninth', args: [' ', ' '], expected: null }, + { name: 'NaN', args: [NaN, NaN], expected: true }, + { name: 'first', args: [true, 'true'], expected: true}, + { name: 'second', args: [1, '1'], expected: true}, + { name: 'third', args: ['1', '1'], expected: false }, + { name: 'fourth', args: [1000, 1e3], expected: false }, + { name: 'fifth', args: [+0, -0], expected: false }, + { name: 'sixth', args: [1, 1.0], expected: false }, + { name: 'seventh', args: ['', ""], expected: false }, + { name: 'eighth', args: ["", ``], expected: false }, + { name: 'ninth', args: [' ', ' '], expected: true }, ]; function strictInequality(a, b) { // if type OR value are not the same, returns true diff --git a/module-exercises/variables.js b/module-exercises/variables.js index af5adde..325851c 100644 --- a/module-exercises/variables.js +++ b/module-exercises/variables.js @@ -348,7 +348,7 @@ function footnote_var() { evaluate(footnote_var); -{ + console.groupEnd(); document.body.appendChild(document.createElement('hr')); -} + diff --git a/week-1-project/repeat-handler.js b/week-1-project/repeat-handler.js index 2a70508..dd84a83 100644 --- a/week-1-project/repeat-handler.js +++ b/week-1-project/repeat-handler.js @@ -29,7 +29,9 @@ function repeatHandler() { if (numOfRepetitions === 1) return strToRepeat; else return strToRepeat + toRepeat(strToRepeat, numOfRepetitions - 1); } - const repeated = toRepeat(); + + + const repeated = strToRepeat.repeat(numOfRepetitions); // report result to user (this works, no need to change it!) const outputField = document.getElementById("repeat-output"); diff --git a/week-1-project/style.css b/week-1-project/style.css index 834cb59..901237b 100644 --- a/week-1-project/style.css +++ b/week-1-project/style.css @@ -74,8 +74,13 @@ header{ text-align: center; bottom: 0; width: 100%; + position: fixed; } +#repeat-container { + margin-bottom: 100px; +} + @media (max-width: 680px) { .box { diff --git a/week-2-project/.DS_Store b/week-2-project/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..57b1da35f5cf85e109690e8b5f398753920484d9 GIT binary patch literal 6148 zcmeHKL2uJA6n^f?<`f}%Kq|*vkT^_J2ZJ3Zq)@uU4oHX~H~`v`CZdtDxN1_mtrX?L ze}JFBKj9znbKrZnnbsE2P6&aY^!z>1y(VHaOL~SCHP{xLb;wQrGtSi#6 zo^_zmeVou14XL7I%2%SD<8Neu=dMK=6_ij)7v}FESA#fLG1~d#*n{5wrUe#}M^9;= z9#Wqk1Gg~a$x_DWrHlGZIDCblA+_`&yKKEqj*7k#gqvO-F*}M7s zk4zI523Cfa>lS~&Cm2hdybZ@iu8KEk;Vch~RdkBAl!D;_YRjyBK-9%qLDh+4z%k$$ zxC8@sXOdSh5$i%61CD|Jivivrd?;gJu{Nl;4ix$d0Bpjo1vdXKa*l5?uvi;J3q+Vy zph*?>iXluo{JxC~EY=21IthFE5O!o?Zzw{Kj{bceP9iYqO2>d>V3C0}Q*HD4zyIs| z|6-D>IR+d9{}cnF*$?|YyplazS6+_KS|54@W#PEm;CTuReH0^>kK&t9E%5tn00WD) SL3kkUM?lly3dg`7W#Bt5|Ao&0 literal 0 HcmV?d00001 diff --git a/week-2-project/javascript-1 b/week-2-project/javascript-1 new file mode 160000 index 0000000..ed592bd --- /dev/null +++ b/week-2-project/javascript-1 @@ -0,0 +1 @@ +Subproject commit ed592bd1065b38e97f9ac211745ee7de6b6e29ae From c8a6a37501cadaa14ec159496af33c944dba3963 Mon Sep 17 00:00:00 2001 From: akbel Date: Fri, 18 Oct 2019 22:19:41 +0200 Subject: [PATCH 11/12] module exercises and handlers- could not be successful in any of them --- .DS_Store | Bin 8196 -> 10244 bytes module-exercises/arrays.js | 40 ++++- module-exercises/explicit-coercion.js | 6 +- module-exercises/primitive-operators.js | 18 +- module-exercises/primitive-types.js | 13 +- module-exercises/truthiness-operators.js | 77 ++++---- module-exercises/truthiness.js | 59 +++--- week-1-project/repeat-handler.js | 6 - week-2-project/.DS_Store | Bin 6148 -> 8196 bytes week-2-project/index.html | 54 ++++-- week-2-project/javascript-1 | 1 - week-2-project/scripts/caesarize.js | 119 ++++++++++--- week-2-project/scripts/constantize.js | 53 ++++++ week-2-project/scripts/leftpad.js | 124 +++++++++++++ week-2-project/scripts/repeatChars.js | 217 +++++++++++++++++++++-- week-2-project/style.css | 64 +++++++ 16 files changed, 709 insertions(+), 142 deletions(-) delete mode 160000 week-2-project/javascript-1 create mode 100644 week-2-project/scripts/leftpad.js diff --git a/.DS_Store b/.DS_Store index 261421fa57a845532ac03cbf266fac1603426403..00d476ce1e1559c0f1f447810c6ccc435d115139 100644 GIT binary patch delta 737 zcmZp1XbF&DU|?W$DortDU{C-uIe-{M3-C-V6q~50D5wPFFar4uIq8PM$@#ej8w;ng zPizp}%+A5WQ4f-3VbEhpXUJqIfvEtBF)%PcmqM1y&3AE0%E?axig9G*?ToHjb##iTdKi8`X&VfAgY zzbJ+sjenK^JphqFu>&rF>H&rZhRO9}*^~Q3c_!}?6GZceqRQmeVmR!8NMNx8D1qjW z1se-1Sp}Ivu>njr+(5z=lyo*0erKM{FB2%j1W8aDAZcJCG62z&3uJmXZxo({?rmxZ J?c_MoJ^-Vpwv_+? delta 175 zcmZn(XmOBWU|?W$DortDU;r^WfEYvza8FDWo2aKK$_J7M@);OP84?*v7*ZMZ7_v4d zE@t1%&cVXL$hWygU?uZrR?$Aj$@P-blkFr0C$E;|-#krR5hUQfF-?|HkQrzO5J+$X o30IKW8xy}XPv%z%--"], expected: null }, - { name: 'sixth', args: [undefined], expected: null }, - { name: 'seventh', args: [""], expected: null }, - { name: 'eighth', args: [Symbol('hello')], expected: null }, - { name: 'ninth', args: [``], expected: null }, - { name: 'tenth', args: [true], expected: null }, - { name: 'eleventh', args: [1e3], expected: null }, - { name: 'twelfth', args: [0], expected: null }, - { name: 'thirteenth', args: [Symbol()], expected: null }, - { name: 'fourteenth', args: [-0], expected: null }, - { name: 'fifteenth', args: [NaN], expected: null }, - { name: 'sixteenth', args: [Infinity], expected: null }, - { name: 'seventeenth', args: [Symbol(false)], expected: null }, - { name: 'eighteenth', args: [+0], expected: null }, - { name: 'nineteenth', args: [false], expected: null }, + { name: 'first', args: [0.0], expected: false }, + { name: 'second', args: [null], expected: false }, + { name: 'third', args: ['hacking your future!'], expected: true}, + { name: "fourth", args: [''], expected: false }, + { name: 'fifth', args: ["--<(*)>--"], expected: true }, + { name: 'sixth', args: [undefined], expected: false }, + { name: 'seventh', args: [""], expected: false }, + { name: 'eighth', args: [Symbol('hello')], expected: true }, + { name: 'ninth', args: [``], expected: false }, + { name: 'tenth', args: [true], expected: true }, + { name: 'eleventh', args: [1e3], expected: true }, + { name: 'twelfth', args: [0], expected: false }, + { name: 'thirteenth', args: [Symbol()], expected: true }, + { name: 'fourteenth', args: [-0], expected: false }, + { name: 'fifteenth', args: [NaN], expected: false }, + { name: 'sixteenth', args: [Infinity], expected: true }, + { name: 'seventeenth', args: [Symbol(false)], expected: true }, + { name: 'eighteenth', args: [+0], expected: false }, + { name: 'nineteenth', args: [false], expected: false }, ]; Boolean.quizzing = true; evaluate(Boolean, testsToPass); delete Boolean.quizzing; +} catch (err) { + console.log(err); + document.body.appendChild( + evaluate.errorSearchComponent('.js file', err) + ); +} + { console.groupEnd(); document.body.appendChild(document.createElement('hr')); diff --git a/week-1-project/repeat-handler.js b/week-1-project/repeat-handler.js index dd84a83..c5593eb 100644 --- a/week-1-project/repeat-handler.js +++ b/week-1-project/repeat-handler.js @@ -23,12 +23,6 @@ function repeatHandler() { } // pass user input through core logic (write this! it doesn't work) - - function toRepeat(strToRepeat, numOfRepetitions) { - if (numOfRepetitions < 0) return ""; - if (numOfRepetitions === 1) return strToRepeat; - else return strToRepeat + toRepeat(strToRepeat, numOfRepetitions - 1); - } const repeated = strToRepeat.repeat(numOfRepetitions); diff --git a/week-2-project/.DS_Store b/week-2-project/.DS_Store index 57b1da35f5cf85e109690e8b5f398753920484d9..dd93dfcd4d70038069a6c967a8fe1b8f4e911f88 100644 GIT binary patch delta 557 zcmZoMXmOBWU|?W$DortDU;r^WfEYvza8E20o2aMAD7Z0TH{<3H%;GFS;wj@|b`Fk- z4J?d;lX;lT19=#-7!n!EfVh|;nW2awlc9j2gh7|V&@(4LIVmSU31kw`{LesI<3AVx zSquy~^-bQybiE#@Y)-miaB_Zb0oV)(fm3a6zKaXg1t342xwGn^BR-pR^HZSe{frb@NARfR_1#>pY)wool zx;21-VRA8(;N%(1cAN8f7BF*3a09J(1x5Pihs@uZC-aLqPIl)J;9!KL2Zqh@Jad=< DMYMd{ delta 120 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{MGjUEV6q~50$jG)aU^gQp+hiUA^UdBup^TFa zMC>*e8?r2B=im@z2C4)C0d64S3evQ(@H_Klei=uQsSJz^3@jj;31Tc*Y;!!%9A*Ha CTM^y> diff --git a/week-2-project/index.html b/week-2-project/index.html index 8badc8c..f8653e8 100644 --- a/week-2-project/index.html +++ b/week-2-project/index.html @@ -5,54 +5,70 @@ - week 2 project + AKBEL-week 2 project - + +
+

HELLo from week two javascript project

+ +
-
-
-
-

-  
- - -
+ +



   
+

The function should give you 2 times of the letters, 3 times of the numbers, 4 times of the symbols and the space. +

-
+



   
+
+

The function should make every letters capital and ignore the symbols. Also the space should be '_'

+
- -
+




   
+
+

The function should shift the letters you typed according to the number you gave.

+
+ +
+ + + +
+

+  
+
+

Type a word, give a length (a number), choose a pattern or just leave it.
+ The function should translate the word you typed according to the length that you wanted.

+
+ + + - -
-
- - + - + \ No newline at end of file diff --git a/week-2-project/javascript-1 b/week-2-project/javascript-1 deleted file mode 160000 index ed592bd..0000000 --- a/week-2-project/javascript-1 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ed592bd1065b38e97f9ac211745ee7de6b6e29ae diff --git a/week-2-project/scripts/caesarize.js b/week-2-project/scripts/caesarize.js index 4eac053..a350957 100644 --- a/week-2-project/scripts/caesarize.js +++ b/week-2-project/scripts/caesarize.js @@ -9,43 +9,122 @@ */ const caesarizeTests = [ - { name: 'first', args: ["aBcD", 3], expected: 'dEfG' }, - { name: 'second', args: ["aBcD", -3], expected: 'xYzA' }, - { name: 'third', args: ["heLLo worLd!", 0], expected: 'heLLo worLd!' }, - { name: 'fourth', args: ["heLLo worLd!", 1], expected: 'ifMMp xpsMe!' }, - { name: 'fifth', args: ["", 5], expected: '' }, - { name: 'sixth', args: ["mnOpQr", 26], expected: 'mnOpQr' }, - { name: 'seventh', args: ["#@&&^F*(#", 7], expected: '#@&&^L*(#' }, + { name: "first", args: ["aBcD", 3], expected: "dEfG" }, + { name: "second", args: ["aBcD", -3], expected: "xYzA" }, + { name: "third", args: ["heLLo worLd!", 0], expected: "heLLo worLd!" }, + { name: "fourth", args: ["heLLo worLd!", 1], expected: "ifMMp xpsMe!" }, + { name: "fifth", args: ["", 5], expected: "" }, + { name: "sixth", args: ["mnOpQr", 26], expected: "mnOpQr" }, + { name: "seventh", args: ["#@&&^F*(#", 7], expected: "#@&&^M*(#" } ]; + function caesarize(str, shiftNum) { // write me! + +/* I could not write a funtcion. +I tried to understand the logic and the way a function builts +by looking at what the others wrote in slack and homework sheet for caesarize. +I compared the codes, try to understand everything that is written and what are the differences,why and how. + + +/* here are the ones I have looked: + +//luis ceasirise + +const caesarized = caesarize(strToCaesarize, shiftNumber); + +//ceaseirize mert + +function caesarize(str, shiftNum) { + var input = str; + + var str = input.split(""); + + var code = input.split(""); + + var ceasared = input.split(""); + + for (var i = 0; i < str.length; i++) { + code[i] = str[i].charCodeAt(); + if (code[i] >= 97 && code[i] <= 122) { + code[i] += shiftNum; + if (code[i] > 122) { + code[i] = code[i] - 26; + } else if (code[i] < 97) { + code[i] = code[i] + 26; + } + ceasared[i] = String.fromCharCode(code[i]); + } else if (code[i] >= 65 && code[i] <= 90) { + code[i] += shiftNum; + if (code[i] > 90) { + code[i] = code[i] - 26; + } else if (code[i] < 65) { + code[i] = code[i] + 26; + } + ceasared[i] = String.fromCharCode(code[i]); + } + } + return ceasared.join(""); } -evaluate(caesarize, caesarizeTests); +//ceasirize mustafa in hw sheet -function caesarizeHandler() { +function caesarize(str, shiftNum) { + // write me! + let result = Array(str.length); + + for (let i = 0; i < str.length; i++) { + let code = str.charCodeAt(i); + + let lower = "a".charCodeAt(0); + + if (code >= lower && code < lower + 26) + code = ((code - lower + shiftNum) % 26) + lower; + + let upper = "A".charCodeAt(0); + + if (code >= upper && code < upper + 26) + code = ((code - upper + shiftNum) % 26) + upper; + + result[i] = String.fromCharCode(code); + } + return result.join(""); +} + +//ibrahim hw ceasrz + +function caesarize(str, shiftNum) { + // write me! + var strCode = str.charCodeAt(); + var newStrCode = strCode + shiftNum; + return String.fromCharCode(newStrCode); +} + */ +evaluate(caesarize, caesarizeTests); + +function caesarizeHandler() { // read and process user input (this works, no need to change it!) - const strToCaesarize = document.getElementById('caesarize-string-input').value; + const strToCaesarize = document.getElementById("caesarize-string-input") + .value; - const rawNumInput = document.getElementById('caesarize-number-input').value; + const rawNumInput = document.getElementById("caesarize-number-input").value; const shiftNumber = Number(rawNumInput); if (isNaN(shiftNumber)) { throw new TypeError('second input to "caesarize it" must be a number'); } - // pass user input through core logic (this works! no need to change it) const caesarized = caesarize(strToCaesarize); // report result to user (this works, no need to change it!) - const outputField = document.getElementById('caesarize-output'); + const outputField = document.getElementById("caesarize-output"); outputField.innerHTML = caesarized; - console.log('\n--- caesarizeHandler ---'); - console.log('strToCaesarize:', typeof strToCaesarize, ',', strToCaesarize); - console.log('shiftNumber:', typeof shiftNumber, ',', shiftNumber); - console.log('caesarized:', typeof caesarized, ',', caesarized); -}; -const caesarizeButton = document.getElementById('caesarize-button'); -caesarizeButton.addEventListener('click', caesarizeHandler); + console.log("\n--- caesarizeHandler ---"); + console.log("strToCaesarize:", typeof strToCaesarize, ",", strToCaesarize); + console.log("shiftNumber:", typeof shiftNumber, ",", shiftNumber); + console.log("caesarized:", typeof caesarized, ",", caesarized); +} +const caesarizeButton = document.getElementById("caesarize-button"); +caesarizeButton.addEventListener("click", caesarizeHandler); diff --git a/week-2-project/scripts/constantize.js b/week-2-project/scripts/constantize.js index 8beed0c..a517b8b 100644 --- a/week-2-project/scripts/constantize.js +++ b/week-2-project/scripts/constantize.js @@ -24,6 +24,59 @@ const constantizeTests = [ ]; function constantize(str) { // write me! + +/* I could not write a funtcion. +I tried to understand the logic and the way a function builts +by looking at stackowerflof,khanacademy exercises and what did my friends wrote in slack and homework sheet for constantize. +I compared the codes, try to understand everything that is written and what are the differences,why and how. + +here are the ones I have looked. + +*** actually ibrahim used the same function that Luis sent by deleting only one () and adding an extra ; +I did not understand how his worked. when I tried it it did not worked. *** + +//luisk + +function constantize(str) { + // write me! + const newStrArrNoSpacesCapitalized = str.toUpperCase().split(' '); + + const wordsFiltered = newStrArrNoSpacesCapitalized.map((word) => { + const wordArr = word.split(''); + const wordArrFiltered = wordArr + .filter((c) => { + return c.charCodeAt() >= 65 && c.charCodeAt() <= 90; + }); + const newWord = wordArrFiltered.join(''); + return newWord; + }); + + return wordsFiltered.join('_') + } + +// ibrahim hw constantize + +function constantize(str) { + // write me! + + const newStrArrNoSpacesCapitalized = str.toUpperCase().split(" "); + + const wordsFiltered = newStrArrNoSpacesCapitalized.map(word => { + const wordArr = word.split(""); + const wordArrFiltered = wordArr.filter(c => { + return c.charCodeAt() >= 65 && c.charCodeAt() <= 90; + }); + const newWord = wordArrFiltered.join(""); + return newWord; + }); + + return wordsFiltered.join("_"); + } + + + +*/ + } evaluate(constantize, constantizeTests); diff --git a/week-2-project/scripts/leftpad.js b/week-2-project/scripts/leftpad.js new file mode 100644 index 0000000..9b5dbb2 --- /dev/null +++ b/week-2-project/scripts/leftpad.js @@ -0,0 +1,124 @@ +/* leftpad! +Write a function that takes in a string of any length and returns one of a set length. +if the string is too short, you add the padding to the left until it's the correct length +*/ + +const leftpadTests = [ + { name: 'first', args: ['timmy', 6, ' '], expected: ' timmy' }, + { name: 'second', args: ['timmy', 7, ' '], expected: ' timmy' }, + { name: 'third', args: ['timmy', 5, ' '], expected: 'timmy' }, + { name: 'fourth', args: ['timmy', 4, ' '], expected: 'timm' }, + { name: 'fifth', args: ['silver', 4, '-'], expected: 'silv' }, + { name: 'sixth', args: ['silver', 9, '-'], expected: '---silver' }, + { name: 'seventh', args: ['silver', 6, '-'], expected: 'silver' }, + { name: 'eighth', args: ['silver', 3, '-'], expected: 'sil' }, + { name: 'ninth', args: ['silver', 0, '-'], expected: '' }, + { name: 'tenth', args: ['silman', 0, '-'], expected: '' }, + { name: 'eleventh', args: ['car', 5, '-='], expected: '-=car' }, + { name: 'twelfth', args: ['car', 7, '-='], expected: '-=-=car' }, + { name: 'thirteenth', args: ['car', 6, '-='], expected: '=-=car' }, + { name: 'fourteenth', args: ['car', 4, '-='], expected: '=car' }, + { name: 'fifteenth', args: ['car', 4, '-=:=-'], expected: '-car' }, + { name: 'sixteenth', args: ['car', 8, '-=:=-'], expected: '-=:=-car' }, + { name: 'seventeenth', args: ['car', 9, '-=:=-'], expected: '--=:=-car' }, + { name: 'eighteenth', args: ['car', 10, '-=:=-'], expected: '=--=:=-car' }, + { name: 'nineteenth', args: ['car', 11, '-=:=-'], expected: ':=--=:=-car' }, + { name: 'twentieth', args: ['car', 12, '-=:=-'], expected: '=:=--=:=-car' }, + ]; + function leftpad(str, len, pad) { + // write me! + + /* I understand leftpad handler. ' https://github.com/left-pad/left-pad/blob/master/test.js ' this link gives good examples but simple ones. + I still could not write the function by myself. + +here are the ones I have looked and compared and try to understand how they constuct the function. + +//github leftpad + +https://github.com/left-pad/left-pad/blob/master/test.js + +//leftpad mozilla + +function leftFillNum(num, targetLength) { + return num.toString().padStart(targetLength, 0); +} + +const num = 123; +console.log(leftFillNum(num, 5)); +// expected output: "00123" + + +//leftpad ibrahim + +function leftpad(str, len, pad) { + // write me! + var lenStr = str.length; + var strReturn = ""; + if (lenStr == len) { + strReturn = str; + } else if (lenStr > len) { + strReturn = str.substring(0, len); + } else if (lenStr < len) { + var s = len - lenStr; + var padReturn = pad.repeat(s); + strReturn = padReturn + str; + } + return strReturn; + } + +//lefpad mustafa in hw sheet not a full one + +function leftpad(str, len, pad) { + // write me! + if (!pad) { + pad = "."; + } + + str = String(str); + if (pad.length !== 1) len = len - str.length; + strPad = ""; + for (i = 0; i < len; ++i) { + strPad += pad; + } + + return strPad + str; + } + +*/ + + } + evaluate(leftpad, leftpadTests); + + + function leftpadHandler() { + + // read and process user input (this works, no need to change it!) + const stringToPad = document.getElementById('leftpad-str-input').value; + const targetLengthStr = document.getElementById('leftpad-str-input').value; + let targetLength; + if (isNaN(targetLengthStr) || targetLengthStr === '') { + throw new TypeError('length needs to be a number'); + } else { + targetLength = Number(targetLengthStr); + } + const padding = document.getElementById('leftpad-pad-input').value; + + // pass user input through core logic (this works! no need to change it) + const leftpadded = leftpad(stringToPad, targetLength, padding); + + // report result to user (this works, no need to change it!) + const outputField = document.getElementById('leftpad-output'); + outputField.innerHTML = leftpadded; + + console.log('\n--- leftpadHandler ---'); + console.log('stringToPad:', typeof stringToPad, ',', stringToPad); + console.log('targetLength:', typeof targetLength, ',', targetLength); + console.log('padding:', typeof padding, ',', padding); + console.log('leftpadded:', typeof leftpadded, ',', leftpadded); + }; + const leftpadButton = document.getElementById('leftpad-button'); + leftpadButton.addedEventListener('click', leftpadHandler); + + + // https://www.npmjs.com/package/left-pad + // https://programmingpraxis.com/2016/03/25/leftpad/ \ No newline at end of file diff --git a/week-2-project/scripts/repeatChars.js b/week-2-project/scripts/repeatChars.js index d2209b6..531b327 100644 --- a/week-2-project/scripts/repeatChars.js +++ b/week-2-project/scripts/repeatChars.js @@ -8,36 +8,219 @@ write a function that repeats the charecters in a string according to these rule */ const repeatCharsTests = [ - { name: 'first', args: ['abc'], expected: 'aabbcc' }, - { name: 'second', args: ['123'], expected: '111222333' }, - { name: 'third', args: ['%-*>'], expected: '%%%%----****>>>>' }, - { name: 'fourth', args: ['h3LL0 W@r!|)'], expected: 'hh333LLLL000 WW@@@@rr!!!!||||))))' }, - { name: 'fifth', args: ['{:-<*>-:}'], expected: '{{{{::::----<<<<****>>>>----::::}}}}' }, - { name: 'sixth', args: [''], expected: '' }, - { name: 'seventh', args: [' '], expected: ' ' }, + { name: "first", args: ["abc"], expected: "aabbcc" }, + { name: "second", args: ["123"], expected: "111222333" }, + { name: "third", args: ["%-*>"], expected: "%%%%----****>>>>" }, + { + name: "fourth", + args: ["h3LL0 W@r!|)"], + expected: "hh333LLLL000 WW@@@@rr!!!!||||))))" + }, + { + name: "fifth", + args: ["{:-<*>-:}"], + expected: "{{{{::::----<<<<****>>>>----::::}}}}" + }, + { name: "sixth", args: [""], expected: "" }, + { name: "seventh", args: [" "], expected: " " } ]; function repeatChars(str) { // write this! + + + /* + + I could not write the funtcion. +I tried to understand the logic and the way a function builts +by looking at stackowerflof and what did my friends wrote in slack and homework sheet for repeat. +I compared the codes, try to understand everything that is written and what are the differences,why and how. + +//stackoverflow repeat + +var repeat = function(str, count) { + var array = []; + for(var i = 0; i < count;) + array[i++] = str; + return array.join(''); } -evaluate(repeatChars, repeatCharsTests); +//stackoverflow repeat 2 -function repeatCharsHandler() { +var repeatString = function(string, n) { + var result = '', i; + + for (i = 1; i <= n; i *= 2) { + if ((n & i) === i) { + result += string; + } + string = string + string; + } + + return result; +}; + + + //evan to masha repeat + +// more descriptive variable names +function repeatChars(stringInput){ + let result = ''; + let numOfRepeat; + //let numOfRepeat = 0; + for ( let i=0; i1) + // always use ===, not ==. this will avoid tricky bugs + ? 1 + : ((65 <= chCode && chCode<= 90)||(97 <= chCode && chCode<= 122)) + ? 2 + : (48 <= chCode && chCode<= 57) + ? 3 + : 4; + + result += stringInput[i].repeat(numOfRepeat); + } + + return result; + + } + + //repeat masha + function repeatChars(stringInput){ + let c = ``; + let b; + let numOfRepeat; + //let numOfRepeat = 0; + for ( let i=0; i1) ? 1: + ((65 <= b && b<= 90)||(97 <= b && b<= 122)) ? 2: + (48 <= b && b<= 57) ? 3: + 4; + + c += stringInput[i].repeat(numOfRepeat); + } + + return c; + + } +//repeat evan to mert + +function repeatChars(str) { + var strArray = str.split(''); + strArray.forEach(function(str) { + var code=str.charCodeAt(); +​ + if (code<=90 && code>=65)||(code<=122 && code>=97); { + str= str + str; + } + else if (code<=57 && code>=48 ) { + str=str+str+str; + } + else { + str=str+str+str+str; + } + }); + return '?'; +}; + //repeat mustafa in the hw sheet + + function repeatChars(str) { + let newString = ""; + + const splittedStr = str.split(""); + + splittedStr.forEach(element => { + if (/[0-9]/.test(element)) { + // + newString = newString + element + element + element; + } else { + if (/[a-zA-Z]/.test(element)) { + newString = newString + element + element; + } else { + newString = newString + element + element + element + element; + } + } + }); + return newString; + } + +//repeat mustafa slack +repeatChars.js ....... function repeatChars(str) { + let count = str.split('').reduce(function(countMap, word) { + countMap[word] = ++countMap[word] || 1; + return countMap; + }, {}); + //Get the letters that were found, and filter out any that only appear once. + let repeat = Object.keys(count) + //.filter(function (key) { return (count[key] > 1); }) + // Then map it and create a string with the correct length, filled with that letter. + .map(function (key) { + return new Array(count[key] + 1).join(key); + }); + return repeat; + } + evaluate(repeatChars, repeatCharsTests); + +//ibrahim hw repeat + +function repeatChars(str) { + // write this! + var strArray = str.split(""); + var strReturn = ""; + strArray.forEach(function(str) { + var code = str.charCodeAt(); + if ((code <= 90 && code >= 65) || (code <= 122 && code >= 97)) { + str = str + str; + } else if (code <= 57 && code >= 48) { + str = str + str + str; + } else { + str = str + str + str + str; + } + + strReturn = strReturn + str; + }); + + return strReturn; + } + +//repeat mert + +function repeatChars(str) { + var code=str.charCodeAt(); + + if (code<=90 && code>=65)||(code<=122 && code>=97); { + str= str + str; + } + else if (code<=57 && code>=48 ) { + str=str+str+str; + } + else { + str=str+str+str+str; + } + }; + strArray.forEach(repeatChars); + +*/ +} +evaluate(repeatChars, repeatCharsTests); +function repeatCharsHandler() { // read and process user input (this works, no need to change it!) - const stringInput = document.getElementById('repeatChars-input').value; + const stringInput = document.getElementById("repeatChars-input").value; // pass user input through core logic (this works! no need to change it) const repeatCharsed = repeatChars(stringInput); // report result to user (this works, no need to change it!) - const outputField = document.getElementById('repeatChars-output'); + const outputField = document.getElementById("repeatChars-output"); outputField.innerHTML = repeatCharsed; - console.log('\n--- repeatCharsHandler ---'); - console.log('stringInput:', typeof stringInput, ',', stringInput); - console.log('repeatCharsed:', typeof repeatCharsed, ',', repeatCharsed); -}; -const repeatCharsButton = document.getElementById('repeatChars-button'); -repeatCharsButton.addEventListener('click', repeatCharsHandler); + console.log("\n--- repeatCharsHandler ---"); + console.log("stringInput:", typeof stringInput, ",", stringInput); + console.log("repeatCharsed:", typeof repeatCharsed, ",", repeatCharsed); +} +const repeatCharsButton = document.getElementById("repeatChars-button"); +repeatCharsButton.addEventListener("click", repeatCharsHandler); diff --git a/week-2-project/style.css b/week-2-project/style.css index e69de29..606cd2d 100644 --- a/week-2-project/style.css +++ b/week-2-project/style.css @@ -0,0 +1,64 @@ +body{ + font-family: 'Dosis', sans-serif; + background-color:#03101b; + margin:0; + padding:0; + color:beige; + text-align: center; + width: 80%; + } + + +header{ + text-align: center; + font: 30px; + margin: 20px; + padding-top:30px; + padding-bottom: 30px; + min-height:80px; + color: beige; + + } + + .container { + max-width: 600px; + text-align: center; + margin: auto; + margin-top: 25px; + margin-bottom: 25px; + } + + button { + background-color: #eca50b; + border: none; + height: 30px; + width: 200px; + color: #1a1201; + margin: 5px; + font-size: 18px; + } + + button:hover { + background-color: #47e9f5; + } + + input { + color: black; + font-size: 14px; + } + + + + + @media (max-width: 680px) { + .box { + max-width: 400px; + text-align: center; + margin: auto; + margin-top: 10px; + padding: 10px; + } + + body { + font-size: 0.8em; + } \ No newline at end of file From d80421f2dbf35d257c5b850aecbc2f4df6b65745 Mon Sep 17 00:00:00 2001 From: akbel Date: Fri, 25 Oct 2019 23:33:58 +0200 Subject: [PATCH 12/12] week2 homework-caesarize and leftpad some changes --- module-exercises/arrays.js | 29 +++--- module-exercises/loops.js | 10 +- week-2-project/.DS_Store | Bin 8196 -> 6148 bytes week-2-project/scripts/caesarize.js | 127 +++++++++----------------- week-2-project/scripts/class.js | 21 +++++ week-2-project/scripts/constantize.js | 2 + week-2-project/scripts/leftpad.js | 87 +++++++----------- week-2-project/scripts/repeatChars.js | 11 +++ week-3-project/README.md | 18 ++++ week-3-project/handlers/decrypt.js | 15 +-- week-3-project/handlers/encrypt.js | 15 +-- week-3-project/handlers/scramble.js | 4 +- week-3-project/index.html | 16 ++-- 13 files changed, 179 insertions(+), 176 deletions(-) create mode 100644 week-2-project/scripts/class.js diff --git a/module-exercises/arrays.js b/module-exercises/arrays.js index a2e2c6c..617a906 100644 --- a/module-exercises/arrays.js +++ b/module-exercises/arrays.js @@ -145,7 +145,7 @@ function passTheAssertions2() { ; // write this line - value2 = value1; + let value2 = value1; console.assert(value2 === value1, "value1 should strictly equal value2"); @@ -155,14 +155,14 @@ function passTheAssertions2() { console.assert(reference2 === reference1, "reference1 should strictly equal reference2"); - value2 = value2 + 1; // write this line - value1 = 6; + value2 = value2 + 1; value1 = '___'; + console.assert(value1 !== null, "value1 should strictly equal ___"); ; // write this line referans1[0] = reference2[0]; - reference1.push('hi!'); + reference1 [0] = ['hi!']; console.log(reference2); console.assert(reference1[0] === reference2[0], "references[0] should be strictly equal"); @@ -174,11 +174,8 @@ function passTheAssertions2() { console.assert(reference1 === reference2, "references should be strictly equal"); // remove the array from memory - ; // write this line - ; // write this line - - reference1 = null; - reference2 = null; + ; reference1 = null; + ; reference2 = null; } evaluate(passTheAssertions2); @@ -186,9 +183,12 @@ evaluate(passTheAssertions2); function passTheAssertions3() { ; // write this line ; // write this line - - const arr1=[]; - let arr2=[]; +arr1 = []; +arr2 = []; +arr1[1] = arr2[1]; +arr[1] = ['B'] + + console.assert(arr1 !== arr2, 'the variables should not be strictly equal'); console.assert(arr1[1] === arr2[1], 'their first entries should be the same'); console.assert(arr1[1] === 'B', 'arr1[1]] should be "B"'); @@ -199,10 +199,15 @@ function passTheAssertions3() { ; // write this line ; // write this line + arr1[arr2[2]] = ['B']; + arr1[arr2[2]] = arr2[arr1[2]]; + console.assert(arr1[arr2[2]] === 'B', 'arr2[2] should be "B"s index in arr1'); console.assert(arr1[arr2[2]] === arr2[arr1[2]], 'some tricky nested thing should be true'); ; // write this line + + console.assert(arr1 !== arr2, 'arr1 should strictly equal arr2'); console.assert(arr3 !== arr1, 'arr3 should not strictly equal arr`'); console.assert(arr3 === arr2, 'arr3 should strictly equal arr2'); diff --git a/module-exercises/loops.js b/module-exercises/loops.js index 0d67c58..99e9079 100644 --- a/module-exercises/loops.js +++ b/module-exercises/loops.js @@ -103,12 +103,14 @@ function loopRefactor1() { while (i !== 8) { whileResult += i; i += 2; + } // fix the three pieces of this for loop to pass the assert let forResult = 0; - for (null; null; null) { + for (let i=0; i!==8; i+=2) { forResult += i; + } console.assert(forResult === whileResult, 'both loops should have the same behavior'); @@ -127,10 +129,10 @@ function loopRefactor2() { // fix the three pieces of this for loop to pass the assert let whileResult = 0; - null; - while (null) { + i=5; + while (i>-2) { whileResult = whileResult + i; - null; + i--; } console.assert(forResult === whileResult, 'both loops should have the same behavior'); diff --git a/week-2-project/.DS_Store b/week-2-project/.DS_Store index dd93dfcd4d70038069a6c967a8fe1b8f4e911f88..0c07ac5e7354040106c49edff9681f21c36f4ed6 100644 GIT binary patch delta 108 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{Mvv5r;6q~50$jG%ZU^g=(*JK_6^UdBu%1j%J u7cwqp=im@z2C4!A0d64S3evE#@H_Klei=`Yb_OPhQ6SS9HplbKVFm!qpb-!N delta 416 zcmZoMXmOBWU|?W$DortDU;r^WfEYvza8E20o2aMAD7Z0TH}hr%jz7$c**Q2SHn1=X zPUc}T59DFUVn}2t1L9(aWQHP!Oojr65(ZrcL(iQ2= 97 && code[i] <= 122) { - code[i] += shiftNum; - if (code[i] > 122) { - code[i] = code[i] - 26; - } else if (code[i] < 97) { - code[i] = code[i] + 26; - } - ceasared[i] = String.fromCharCode(code[i]); - } else if (code[i] >= 65 && code[i] <= 90) { - code[i] += shiftNum; - if (code[i] > 90) { - code[i] = code[i] - 26; - } else if (code[i] < 65) { - code[i] = code[i] + 26; - } - ceasared[i] = String.fromCharCode(code[i]); - } - } - return ceasared.join(""); + + //my array to split + let array = a.split(''); + + //my array for splitted strings + let NEWarray = array.map(x =>{ + + let letternumber = x.charcodeAt(); + + + //for the letters a-z + if (letternumber >= 97 && letternumber <= 122){ + + letternumber += shiftNum; + if (letternumber > 122) {letternumber -= 26;} + else if (letternumber < 97) {letternumber += 26;} + + myCode = String.fromCharCode(letternumber);} + + // for the letters A-Z + else if (letternumber <= 90 && letternumber >= 65){ + + letternumber += shiftNum; + if (letternumber > 90) {letternumber -= 26} + else if (letternumber < 65) {letternumber += 26} + + myCode = String.fromCharCode(letternumber);} + + // for special characters and numbers + else {myCode = x;} + return myCode; + + }); + + return NEWarray.join(''); } -//ceasirize mustafa in hw sheet - -function caesarize(str, shiftNum) { - // write me! - - let result = Array(str.length); - for (let i = 0; i < str.length; i++) { - let code = str.charCodeAt(i); - let lower = "a".charCodeAt(0); - - if (code >= lower && code < lower + 26) - code = ((code - lower + shiftNum) % 26) + lower; - - let upper = "A".charCodeAt(0); - - if (code >= upper && code < upper + 26) - code = ((code - upper + shiftNum) % 26) + upper; - - result[i] = String.fromCharCode(code); - } - return result.join(""); -} - -//ibrahim hw ceasrz - -function caesarize(str, shiftNum) { - // write me! - var strCode = str.charCodeAt(); - var newStrCode = strCode + shiftNum; - return String.fromCharCode(newStrCode); -} - */ evaluate(caesarize, caesarizeTests); function caesarizeHandler() { @@ -121,10 +78,10 @@ function caesarizeHandler() { const outputField = document.getElementById("caesarize-output"); outputField.innerHTML = caesarized; - console.log("\n--- caesarizeHandler ---"); - console.log("strToCaesarize:", typeof strToCaesarize, ",", strToCaesarize); - console.log("shiftNumber:", typeof shiftNumber, ",", shiftNumber); - console.log("caesarized:", typeof caesarized, ",", caesarized); -} -const caesarizeButton = document.getElementById("caesarize-button"); -caesarizeButton.addEventListener("click", caesarizeHandler); + console.log('\n--- caesarizeHandler ---'); + console.log('strToCaesarize:', typeof strToCaesarize, ',', strToCaesarize); + console.log('shiftNumber:', typeof shiftNumber, ',', shiftNumber); + console.log('caesarized:', typeof caesarized, ',', caesarized); +}; +const caesarizeButton = document.getElementById('caesarize-button'); +caesarizeButton.addEventListener('click', caesarizeHandler); \ No newline at end of file diff --git a/week-2-project/scripts/class.js b/week-2-project/scripts/class.js new file mode 100644 index 0000000..f1cc188 --- /dev/null +++ b/week-2-project/scripts/class.js @@ -0,0 +1,21 @@ +function calculate(a,b,operation) { + switch (operation){ +case sum : return a+b +case subtraction : return a-b +default: return a*b + } +} + +function calculate(a,b,operation){ + + if(operation==="+"){return a+b} + else if (operation ==="-") { return a-b} + else if (operation ==="*") {return a*b} + else (operation ==="/"); {if(b===0) {return undefined} + else if (a===0) {return 0} + return a/b} + +} + +for(let index = 0; index< Array.length; index++) //zero to length of array + diff --git a/week-2-project/scripts/constantize.js b/week-2-project/scripts/constantize.js index a517b8b..373751a 100644 --- a/week-2-project/scripts/constantize.js +++ b/week-2-project/scripts/constantize.js @@ -23,6 +23,8 @@ const constantizeTests = [ { name: 'sixth', args: ['ALREADY_A_CONSTANT'], expected: 'ALREADY_A_CONSTANT' }, ]; function constantize(str) { + + // write me! /* I could not write a funtcion. diff --git a/week-2-project/scripts/leftpad.js b/week-2-project/scripts/leftpad.js index 9b5dbb2..9b4751b 100644 --- a/week-2-project/scripts/leftpad.js +++ b/week-2-project/scripts/leftpad.js @@ -25,68 +25,51 @@ const leftpadTests = [ { name: 'nineteenth', args: ['car', 11, '-=:=-'], expected: ':=--=:=-car' }, { name: 'twentieth', args: ['car', 12, '-=:=-'], expected: '=:=--=:=-car' }, ]; - function leftpad(str, len, pad) { - // write me! - - /* I understand leftpad handler. ' https://github.com/left-pad/left-pad/blob/master/test.js ' this link gives good examples but simple ones. - I still could not write the function by myself. - -here are the ones I have looked and compared and try to understand how they constuct the function. - -//github leftpad + + function leftpad(string, road, pattern) { + + const stringLength = string.length; + const patternLength = pattern.length; -https://github.com/left-pad/left-pad/blob/master/test.js + if (road === 0) {return '';} + if (stringLength === road) {return string;} + else if (road < stringLength) {return string.substring(0,road);} + + //if road will be longer then the string length, I have to arrange the pattern + + //desired patern + let patternString = ''; -//leftpad mozilla + // how long will be the last pattern string + const LastPatternLength = road - stringLength; -function leftFillNum(num, targetLength) { - return num.toString().padStart(targetLength, 0); -} + // to follow Luis + // even after reading Luis's code I could not able to write correctly the rest of the function by myself + // I have looked for module operator %, + // understand what it means but I could not use it in another case (tried in KhanAcademy) + // i need more examples for module operators and math.floor -const num = 123; -console.log(leftFillNum(num, 5)); -// expected output: "00123" + const howManyTimesPatternFits = Mat.floor(LastPatternLength / patternLength); + for (let i = 1; i<= howManyTimesPatternFits; i += 1){ + patternString = patternString + pattern; + } + + // exp: string = 3 characters and pattern = 3 characters, desired length is 10. + // then I need to type 2 times of my pattern and 1 charachter from pattern, then write the string. + // the problem is how to chose this 1 charachter (will it be the end letter of the patern or begining letter) + const theRestPattern = LastPatternLength % patternLength; -//leftpad ibrahim + const karakterNeeded = pattern.substring(patternLength - theRestPattern); -function leftpad(str, len, pad) { - // write me! - var lenStr = str.length; - var strReturn = ""; - if (lenStr == len) { - strReturn = str; - } else if (lenStr > len) { - strReturn = str.substring(0, len); - } else if (lenStr < len) { - var s = len - lenStr; - var padReturn = pad.repeat(s); - strReturn = padReturn + str; - } - return strReturn; - } + patternString = karakterNeeded + patternString; -//lefpad mustafa in hw sheet not a full one + const LastPatternString = patternString + string; -function leftpad(str, len, pad) { - // write me! - if (!pad) { - pad = "."; - } - - str = String(str); - if (pad.length !== 1) len = len - str.length; - strPad = ""; - for (i = 0; i < len; ++i) { - strPad += pad; - } - - return strPad + str; - } + return LastPatternString; -*/ - } + } evaluate(leftpad, leftpadTests); @@ -117,7 +100,7 @@ function leftpad(str, len, pad) { console.log('leftpadded:', typeof leftpadded, ',', leftpadded); }; const leftpadButton = document.getElementById('leftpad-button'); - leftpadButton.addedEventListener('click', leftpadHandler); + leftpadButton.addEventListener('click', leftpadHandler); // https://www.npmjs.com/package/left-pad diff --git a/week-2-project/scripts/repeatChars.js b/week-2-project/scripts/repeatChars.js index 531b327..4aab375 100644 --- a/week-2-project/scripts/repeatChars.js +++ b/week-2-project/scripts/repeatChars.js @@ -25,6 +25,17 @@ const repeatCharsTests = [ { name: "seventh", args: [" "], expected: " " } ]; function repeatChars(str) { + +const myLettersArray = ['a','b','c'] +const strArray = str.split(''); + +const resultArray = strArray.map((element)=>{ + if (myLettersArray.indexOf(element) >0){ return element + element; + + } +}) + + // write this! diff --git a/week-3-project/README.md b/week-3-project/README.md index 0fbaea2..c521024 100644 --- a/week-3-project/README.md +++ b/week-3-project/README.md @@ -3,3 +3,21 @@ your tasks in this week's project: * structure, style & responsivize the ```./index.html``` file the handlers all work as they are. nothing to change, but still good to study! + +## Week 3 Project + +This week's project introduces two key concepts: +1. __Encoding & Decoding__: The _encrypt_ and _decrypt_ user stories use the same function! One of the core concepts in web development and programming in general is transforming data from one format, to another, and back again. You've been doing this without knowing it! In last week's project you probably solved at least one of the challenges by converting your string to an array, solving the problem as an array, them converting back to a string. +1. __Problem Decomposition__: This is the skill of breaking larger problems into smaller one, solving the smaller problems, and recombining the small solutions into a complete solution. With the _scramble_ user story, we've helped you along by already breaking down the problem into smaller pieces that can be recombined to solve the larger one. Now it's up to you to solve them and recombine them! + + +--- + +| __a user can ...__ | _User Interface_ | _Handlers_ | _Core Logic_ | +| --- | --- | --- | --- | +| _... visit the page_ | (already done for you) | nothing! | nothing! | +| _know what this page is for_ | Structure the page (header, footer, sections, ...)
provide some explanation of what everything will do | (nothing!) | (nothing!) | +| _... encrypt a string_ | nothing | write the middle section | pass all tests for the ```caesarize``` function | +| _... decrypt a string_ | nothing | write the middle section | nothing, you already wrote ```caesarize```! | +| _... scramble a string_ | nothing | nothing | pass all tests for ```chunk```, ```sort-words``` and ```reverse-chunk```.
then use those functions to pass the ```scramble``` tests | +| _... have a pleasant user experience_ | write a stylish styling sheet
make sure everything is responsive | nothing | nothing | \ No newline at end of file diff --git a/week-3-project/handlers/decrypt.js b/week-3-project/handlers/decrypt.js index 5878ad6..6d2569c 100644 --- a/week-3-project/handlers/decrypt.js +++ b/week-3-project/handlers/decrypt.js @@ -1,21 +1,24 @@ function decryptHandler() { // read and process user input (this works, no need to change it!) - const strToDecrypt = document.getElementById('encrypted-string-output').value; + const encryptedArea = document.getElementById('encrypted-text-area'); + const strToDecrypt = encryptedArea.value; - const rawNumInput = document.getElementById('decryption-key-input').value; + const keyInput = document.getElementById('encryption-key-input'); + const rawNumInput = keyInput.value; const shiftNumber = Number(rawNumInput); if (isNaN(shiftNumber)) { throw new TypeError('decryption key must be a number'); } - // pass user input through core logic (this works! no need to change it) - const decrypted = caesarize(strToDecrypt); + // pass user input through core logic + const decrypted = 'write me!'; // report result to user (this works, no need to change it!) - const outputField = document.getElementById('decrypted-string-output'); - outputField.innerHTML = decrypted; + keyInput.value = ''; + const decryptedArea = document.getElementById('decrypted-text-area'); + decryptedArea.value = decrypted; console.log('\n--- decryptHandler ---'); console.log('strToDecrypt:', typeof strToDecrypt, ',', strToDecrypt); diff --git a/week-3-project/handlers/encrypt.js b/week-3-project/handlers/encrypt.js index b2e3325..af922bc 100644 --- a/week-3-project/handlers/encrypt.js +++ b/week-3-project/handlers/encrypt.js @@ -1,21 +1,23 @@ function encryptHandler() { // read and process user input (this works, no need to change it!) - const strToEncrypt = document.getElementById('unencrypted-string-input').value; + const encryptArea = document.getElementById('encrypted-text-area') + const strToEncrypt = encryptArea.value; - const rawNumInput = document.getElementById('encryption-key-input').value; + const keyInput = document.getElementById('encryption-key-input'); + const rawNumInput = keyInput.value; const shiftNumber = Number(rawNumInput); if (isNaN(shiftNumber)) { throw new TypeError('encryption key must be a number'); } - // pass user input through core logic (this works! no need to change it) - const encrypted = caesarize(strToEncrypt); + // pass user input through core logic + const encrypted = 'write me!'; // report result to user (this works, no need to change it!) - const outputField = document.getElementById('encrypted-string-output'); - outputField.innerHTML = encrypted; + keyInput.value = ''; + encryptArea.value = encrypted; console.log('\n--- encryptHandler ---'); console.log('strToEncrypt:', typeof strToEncrypt, ',', strToEncrypt); @@ -24,3 +26,4 @@ function encryptHandler() { }; const encryptButton = document.getElementById('encrypt-button'); encryptButton.addEventListener('click', encryptHandler); +© 2019 GitHub, Inc. \ No newline at end of file diff --git a/week-3-project/handlers/scramble.js b/week-3-project/handlers/scramble.js index f93a0cd..220b49e 100644 --- a/week-3-project/handlers/scramble.js +++ b/week-3-project/handlers/scramble.js @@ -4,7 +4,7 @@ function scrambleHandler() { const toScramble = document.getElementById('scramble-input').value; // pass user input through core logic (this works! no need to change it) - const scrambled = scramble(toScramble); + const scrambled = 'write me!'; // report result to user (this works, no need to change it!) const outputField = document.getElementById('scramble-output'); @@ -15,4 +15,4 @@ function scrambleHandler() { console.log('scrambled:', typeof scrambled, ',', scrambled); }; const scrambleButton = document.getElementById('scramble-button'); -scrambleButton.addEventListener('click', scrambleHandler); +scrambleButton.addEventListener('click', scrambleHandler); \ No newline at end of file diff --git a/week-3-project/index.html b/week-3-project/index.html index e039e38..9c16455 100644 --- a/week-3-project/index.html +++ b/week-3-project/index.html @@ -12,7 +12,7 @@ - + @@ -21,24 +21,22 @@
-
-
+

-

-     
+

-

+     
- +


-

+    
   
@@ -50,4 +48,4 @@ - + \ No newline at end of file