From eaf884fd48c75f3d27c10f1e89fec06c1813f1c6 Mon Sep 17 00:00:00 2001 From: mouzakiskir Date: Sun, 19 Jan 2020 16:38:53 +0200 Subject: [PATCH 1/6] Week1 js calculator --- Week1/homework/index.css | 29 ++++++++++++++++++++++++++ Week1/homework/index.html | 44 +++++++++++++++++++++++++++++++++++++++ Week1/homework/main.js | 20 ++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 Week1/homework/index.css diff --git a/Week1/homework/index.css b/Week1/homework/index.css new file mode 100644 index 000000000..509f95b5e --- /dev/null +++ b/Week1/homework/index.css @@ -0,0 +1,29 @@ +body{ + width: 1920px; + height: 1024px; +} + +.main, table{ +width: 400px; +height: 400px; +background-color: gainsboro; +} + + + +.textview{ +background-color: greenyellow; +width: 100%; +border:4px; +font-size: 40px; +border-style:inset; + text-align: center; +} + +.button{ + background-color: silver; + width: 100%; + height: 100%; + font-size: 30px; + border-radius: 15px; +} diff --git a/Week1/homework/index.html b/Week1/homework/index.html index e69de29bb..2dbb13980 100644 --- a/Week1/homework/index.html +++ b/Week1/homework/index.html @@ -0,0 +1,44 @@ + + + + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + \ No newline at end of file diff --git a/Week1/homework/main.js b/Week1/homework/main.js index e69de29bb..3e96fbbcf 100644 --- a/Week1/homework/main.js +++ b/Week1/homework/main.js @@ -0,0 +1,20 @@ +function insert(num){ +document.form.textview.value = document.form.textview.value+num +} + +function equal(){ +var exp = document.form.textview.value + +if(exp){ document.form.textview.value = eval(exp) + } + } +function clean(){ + document.form.textview.value = "" +} + +function back(){ + var exp = document.form.textview.value + + document.form.textview.value = exp.substring(0,exp.length-1) + } + From 80d12a18f183fef3a1a8a804550bfc409ff606ea Mon Sep 17 00:00:00 2001 From: mouzakiskir Date: Sun, 26 Jan 2020 20:02:37 +0200 Subject: [PATCH 2/6] Adding week1 exersices --- Week1/homework/{ => js calculator}/index.css | 0 Week1/homework/{ => js calculator}/index.html | 0 Week1/homework/{ => js calculator}/main.js | 0 Week1/homework/js-exercises/1_logHello.js | 11 +++++++++++ Week1/homework/js-exercises/2_ErrorDebugging.js | 2 ++ Week1/homework/js-exercises/3_LogNumber.js | 7 +++++++ 6 files changed, 20 insertions(+) rename Week1/homework/{ => js calculator}/index.css (100%) rename Week1/homework/{ => js calculator}/index.html (100%) rename Week1/homework/{ => js calculator}/main.js (100%) create mode 100644 Week1/homework/js-exercises/1_logHello.js create mode 100644 Week1/homework/js-exercises/2_ErrorDebugging.js create mode 100644 Week1/homework/js-exercises/3_LogNumber.js diff --git a/Week1/homework/index.css b/Week1/homework/js calculator/index.css similarity index 100% rename from Week1/homework/index.css rename to Week1/homework/js calculator/index.css diff --git a/Week1/homework/index.html b/Week1/homework/js calculator/index.html similarity index 100% rename from Week1/homework/index.html rename to Week1/homework/js calculator/index.html diff --git a/Week1/homework/main.js b/Week1/homework/js calculator/main.js similarity index 100% rename from Week1/homework/main.js rename to Week1/homework/js calculator/main.js diff --git a/Week1/homework/js-exercises/1_logHello.js b/Week1/homework/js-exercises/1_logHello.js new file mode 100644 index 000000000..09dba1901 --- /dev/null +++ b/Week1/homework/js-exercises/1_logHello.js @@ -0,0 +1,11 @@ +'use strict' +console.log("Hello, World!") +console.log("Geia sou, Kosme!") +console.log("Ciao, Mondo!") +console.log("Bonjour, le Monde!") +console.log("Hallo, Welt!") +console.log("Hola, Mundo!") +console.log("Hei, Verden!") +console.log("salve, Mundi!") +console.log("Selam, Dunya!") +console.log("Witaj, Wiecie!") \ No newline at end of file diff --git a/Week1/homework/js-exercises/2_ErrorDebugging.js b/Week1/homework/js-exercises/2_ErrorDebugging.js new file mode 100644 index 000000000..abfb656f2 --- /dev/null +++ b/Week1/homework/js-exercises/2_ErrorDebugging.js @@ -0,0 +1,2 @@ +'use strict' +console.log("I'm Awesome") \ No newline at end of file diff --git a/Week1/homework/js-exercises/3_LogNumber.js b/Week1/homework/js-exercises/3_LogNumber.js new file mode 100644 index 000000000..a2e714b02 --- /dev/null +++ b/Week1/homework/js-exercises/3_LogNumber.js @@ -0,0 +1,7 @@ +'use strict' +var numberX +console.log("The value of the numberX is null") +console.log(numberX) +numberX=5 +console.log("Now the number is 5") +console.log(numberX) \ No newline at end of file From 2db19cd69a4aa4facf9c8b4b1b616bf1174b8529 Mon Sep 17 00:00:00 2001 From: mouzakiskir Date: Sun, 2 Feb 2020 16:28:54 +0200 Subject: [PATCH 3/6] Adding 4 exercises --- Week1/homework/js-exercises/3_LogNumber.js | 13 +++++++++- Week1/homework/js-exercises/4_LogString.js | 18 +++++++++++++ Week1/homework/js-exercises/5_RndNum.js | 23 +++++++++++++++++ Week1/homework/js-exercises/6_arrayAnimals.js | 25 +++++++++++++++++++ Week1/homework/js-exercises/7_stringLength.js | 8 ++++++ 5 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 Week1/homework/js-exercises/4_LogString.js create mode 100644 Week1/homework/js-exercises/5_RndNum.js create mode 100644 Week1/homework/js-exercises/6_arrayAnimals.js create mode 100644 Week1/homework/js-exercises/7_stringLength.js diff --git a/Week1/homework/js-exercises/3_LogNumber.js b/Week1/homework/js-exercises/3_LogNumber.js index a2e714b02..4d1813ab8 100644 --- a/Week1/homework/js-exercises/3_LogNumber.js +++ b/Week1/homework/js-exercises/3_LogNumber.js @@ -1,7 +1,18 @@ 'use strict' +/*First, declare your variable numberX. Do not initialize it (which means, don't give it a value) yet.*/ var numberX + +/*Add a console.log statement that explains in words what you think the value of x is, like in this example.*/ console.log("The value of the numberX is null") + +/*Add a console.log statement that logs the value of numberX.*/ console.log(numberX) + +/*Now initialize your variable numberX with a number (also called an integer in computer science terms).*/ numberX=5 -console.log("Now the number is 5") + +/*Next, add a console.log statement that explains what you think the value of numberX is.*/ +console.log("Now the numberX has a value") + +/*Add a console.log statement that logs the value of numberX.*/ console.log(numberX) \ No newline at end of file diff --git a/Week1/homework/js-exercises/4_LogString.js b/Week1/homework/js-exercises/4_LogString.js new file mode 100644 index 000000000..f6c3341db --- /dev/null +++ b/Week1/homework/js-exercises/4_LogString.js @@ -0,0 +1,18 @@ +'use strict' +/*Declare a variable myString and assign a string to it. Use your full name, including spaces, as the content for the string.*/ +let myString="Kiriakos Mouzakis"; + +/*Write a console.log statement in which you explain in words what you think the value of the string is.*/ +console.log("The value of myString is my full name"); + +/*Now console.log the variable myString.*/ +console.log(myString); + +/*Now reassign to the variable myString a new string.*/ +myString=("Now I am Batman"); + +/*Just like what you did before write a console.log statement that explains in words what you think will be logged to the console.*/ +console.log("Now the string has changed"); + +/*Now console.log myString again.*/ +console.log(myString); diff --git a/Week1/homework/js-exercises/5_RndNum.js b/Week1/homework/js-exercises/5_RndNum.js new file mode 100644 index 000000000..07916021f --- /dev/null +++ b/Week1/homework/js-exercises/5_RndNum.js @@ -0,0 +1,23 @@ +'use strict' +/*Declare a variable z and assign the number 7.25 to it.*/ +let z=7.25; + +/*Write a console.log statement in which you log the value of z.*/ +console.log("'Z' value is "+z); + +/*Declare another variable a that has the value of z but rounded to the nearest integer.*/ +let a; +a=Math.round(z); + +/*Write a console.log statement in which you log the value of a.*/ +console.log("'A' has the same value but is rounded "+a); + +/*So now we have z and a find a way to compare the two values and store the highest of the two in a new variable. */ +/*Write a console.log statement in which you log the value of the highest value.*/ +function bigger(){ + if(a>z) {console.log("'A' is bigger with value of "+a) + } + else {console.log("'Z' is bigger with value of "+z) + } +} +bigger() \ No newline at end of file diff --git a/Week1/homework/js-exercises/6_arrayAnimals.js b/Week1/homework/js-exercises/6_arrayAnimals.js new file mode 100644 index 000000000..969a8e941 --- /dev/null +++ b/Week1/homework/js-exercises/6_arrayAnimals.js @@ -0,0 +1,25 @@ +'use strict' +/*Declare variable and assign to it an empty array. +Make sure that the name of the variable indicates it contains more than 1 item. For example items instead of item.*/ +let animals=["tiger","lion","panther"]; + +/*Write a console.log statement that explains in words what you think the value of the array is.*/ +console.log("Arrays are used to store multiple values or strings in a single valiable") + +/*Write a console.log statement that logs the array.*/ +console.log(animals); + +/*Create a new variable with an array that has 3 of your favorite animals, each in a different string. +Make sure the name of the variables says something about what the variable contains.*/ +let tiger=console.log(animals[0]); +let lion=console.log(animals[1]); +let panther=console.log(animals[2]); + +/*Write a console.log statement that logs the second array.*/ +console.log(animals[1]); + +/*Add a statement that adds another string ("Piglet)" to the array of animals.*/ +animals.push("Piglet"); + +/*Write a console.log statement that logs the second array!*/ +console.log(animals[1]); \ No newline at end of file diff --git a/Week1/homework/js-exercises/7_stringLength.js b/Week1/homework/js-exercises/7_stringLength.js new file mode 100644 index 000000000..9d5924ff2 --- /dev/null +++ b/Week1/homework/js-exercises/7_stringLength.js @@ -0,0 +1,8 @@ +/*/Declare a variable called mySentence and initialize it with the following string: "Programming is so interesting!".*/ +let mySentence="Programming is so interesting!"; + +/*Figure out (using Google) how to get the length of mySentence.*/ +let stringLength=mySentence.length; + +/*Write a console.log statement to log the length of mySentence.*/ +console.log(stringLength); \ No newline at end of file From 6463257d8284f2537702fe3338c26c7f9d7b2651 Mon Sep 17 00:00:00 2001 From: mouzakiskir Date: Mon, 3 Feb 2020 01:59:42 +0200 Subject: [PATCH 4/6] testing visual studio code commit --- Week1/homework/js-exercises/7_stringLength.js | 1 + Week1/homework/js-exercises/8_typeChecker.js | 37 +++++++++++++++++++ Week1/homework/js-exercises/9_remainder.js | 9 +++++ 3 files changed, 47 insertions(+) create mode 100644 Week1/homework/js-exercises/8_typeChecker.js create mode 100644 Week1/homework/js-exercises/9_remainder.js diff --git a/Week1/homework/js-exercises/7_stringLength.js b/Week1/homework/js-exercises/7_stringLength.js index 9d5924ff2..da5138ec0 100644 --- a/Week1/homework/js-exercises/7_stringLength.js +++ b/Week1/homework/js-exercises/7_stringLength.js @@ -1,3 +1,4 @@ +'use strict' /*/Declare a variable called mySentence and initialize it with the following string: "Programming is so interesting!".*/ let mySentence="Programming is so interesting!"; diff --git a/Week1/homework/js-exercises/8_typeChecker.js b/Week1/homework/js-exercises/8_typeChecker.js new file mode 100644 index 000000000..895098bb0 --- /dev/null +++ b/Week1/homework/js-exercises/8_typeChecker.js @@ -0,0 +1,37 @@ +'use strict' +/*Write a program that checks the data types of two variables and logs to the console SAME TYPE if they are the same type. +If they are different types log Not the same....*/ +/*Declare 4 variables: 2 must be strings and 2 must be objects*/ +let string1="social"; +let string2="hackers"; +let fname={firstname:"kiriakos"}; +let lname={lastname:"mouzakis"}; + +/*Create 6 conditional statements, where for each you check if the data type of one variable is the same as the other*/ +if (typeof string1 === typeof string2) {console.log("string1 and string2 are the same type");} +if (typeof string1 === typeof fname) {console.log("string1 and fname are the same type");} +if (typeof string1 === typeof lname) {console.log("string1 and lname are the same type");} +if (typeof string2 === typeof fname) {console.log("string2 and fname are the same type");} +if (typeof string2 === typeof lname) {console.log("string2 and lname are the same type");} +if (typeof fname === typeof lname) {console.log("fname and lname are the same type");} + +/*Find out how to check the type of a variable*/ +console.log("You can check a type of a variable with the typeof() command eg.. The type of fname is an "+typeof fname); + +/*Write 2 console.log statements to log the type of 2 variables, each with a different data type*/ +console.log(typeof(string1)); +console.log(typeof(lname)); + +/*Now compare the types of your different variables with one another*/ +/*Log Not the same... when the types are different*/ +let num1=1; +if (typeof string1 === typeof string2) {console.log("string1 and string2 are the same type")} else {console.log("Not the same type"); } +if (typeof string1 === typeof fname) {console.log("string1 and fname are the same type");} else {console.log("Not the same type"); } +if (typeof string1 === typeof lname) {console.log("string1 and lname are the same type");} else {console.log("Not the same type"); } +if (typeof string2 === typeof fname) {console.log("string2 and fname are the same type");} else {console.log("Not the same type"); } +if (typeof string2 === typeof lname) {console.log("string2 and lname are the same type");} else {console.log("Not the same type"); } +if (typeof fname === typeof lname) {console.log("fname and lname are the same type");} else {console.log("Not the same type"); } +if (typeof num1 === typeof string1) {console.log("num1 and string1 are the same type");} else {console.log("Not the same type"); } +if (typeof num1 === typeof string2) {console.log("num1 and string2 are the same type");} else {console.log("Not the same type"); } +if (typeof num1 === typeof fname) {console.log("num1 and fname are the same type");} else {console.log("Not the same type"); } +if (typeof num1 === typeof lname) {console.log("num1 and lname are the same type");} else {console.log("Not the same type"); } \ No newline at end of file diff --git a/Week1/homework/js-exercises/9_remainder.js b/Week1/homework/js-exercises/9_remainder.js new file mode 100644 index 000000000..0abce4e30 --- /dev/null +++ b/Week1/homework/js-exercises/9_remainder.js @@ -0,0 +1,9 @@ +'use strict' +/*For each of these, write in comments what the answer is followed by how you came to that conclusion*/ + +/*If x equals 7, and the only other statement is x = x % 3, what would be the value of x after the calculation?*/ +console.log("At first x will have the value 7, then after the division it will take the value of the modulus (% symbol) and will be 1"); +/*If y equals 21, and the only other statement is y = y % 4, what would be the value of y after the calculation?*/ +console.log("At first y will have the value 21, then after the division it will take the value of the modulus (% symbol) and will be 1"); +/*If z equals 13, and the only other statement is z = z % 2, what would be the value of z after the calculation?*/ +console.log("At first z will have the value 13, then after the division it will take the value of the modulus (% symbol) and will be 1"); From b47067538f8aac5c2d7d28bc8ec9464fd071d82d Mon Sep 17 00:00:00 2001 From: mouzakiskir Date: Mon, 3 Feb 2020 02:04:24 +0200 Subject: [PATCH 5/6] exercise 10 --- Week1/homework/js-exercises/10_compareArrays.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 Week1/homework/js-exercises/10_compareArrays.js diff --git a/Week1/homework/js-exercises/10_compareArrays.js b/Week1/homework/js-exercises/10_compareArrays.js new file mode 100644 index 000000000..923d09640 --- /dev/null +++ b/Week1/homework/js-exercises/10_compareArrays.js @@ -0,0 +1 @@ +'use strict' \ No newline at end of file From 44b49eb1d525eba18117ff57f79463102bb7620a Mon Sep 17 00:00:00 2001 From: mouzakiskir Date: Mon, 3 Feb 2020 02:15:21 +0200 Subject: [PATCH 6/6] made changes --- Week1/homework/js-exercises/6_arrayAnimals.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Week1/homework/js-exercises/6_arrayAnimals.js b/Week1/homework/js-exercises/6_arrayAnimals.js index 969a8e941..deb47a15c 100644 --- a/Week1/homework/js-exercises/6_arrayAnimals.js +++ b/Week1/homework/js-exercises/6_arrayAnimals.js @@ -1,25 +1,23 @@ 'use strict' /*Declare variable and assign to it an empty array. Make sure that the name of the variable indicates it contains more than 1 item. For example items instead of item.*/ -let animals=["tiger","lion","panther"]; +let array1=new Array; /*Write a console.log statement that explains in words what you think the value of the array is.*/ -console.log("Arrays are used to store multiple values or strings in a single valiable") +console.log("The value of the array is empty") /*Write a console.log statement that logs the array.*/ -console.log(animals); +console.log(array1); /*Create a new variable with an array that has 3 of your favorite animals, each in a different string. Make sure the name of the variables says something about what the variable contains.*/ -let tiger=console.log(animals[0]); -let lion=console.log(animals[1]); -let panther=console.log(animals[2]); +let animals=["lion","tiger","panther"]; /*Write a console.log statement that logs the second array.*/ -console.log(animals[1]); +console.log(animals); /*Add a statement that adds another string ("Piglet)" to the array of animals.*/ animals.push("Piglet"); /*Write a console.log statement that logs the second array!*/ -console.log(animals[1]); \ No newline at end of file +console.log(animals); \ No newline at end of file