From a265bd75da4fa21587853e8fc130643082da0571 Mon Sep 17 00:00:00 2001 From: Gooss Date: Mon, 18 Nov 2019 16:33:24 +0100 Subject: [PATCH 1/4] First push --- JS-Basic-Javascript.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 JS-Basic-Javascript.js diff --git a/JS-Basic-Javascript.js b/JS-Basic-Javascript.js new file mode 100644 index 000000000..e69de29bb From 8c32f5726def7cd13617fc554d5d4f4693fb22b2 Mon Sep 17 00:00:00 2001 From: Gooss Date: Mon, 18 Nov 2019 16:50:41 +0100 Subject: [PATCH 2/4] First iteration done --- JS-Basic-Javascript.js | 0 index.js | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) delete mode 100644 JS-Basic-Javascript.js create mode 100644 index.js diff --git a/JS-Basic-Javascript.js b/JS-Basic-Javascript.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/index.js b/index.js new file mode 100644 index 000000000..4258ecf29 --- /dev/null +++ b/index.js @@ -0,0 +1,34 @@ +/*Iteration 1: Names and Input +1.1 Create a variable hacker1 with the driver's name.*/ +let hacker1 = "Juergen"; + + +//1.2 Print "The driver's name is XXXX".// + +console.log(`The driver´s name is ${hacker1}`); + +//1.3 Create a variable hacker2 with the navigator's name.// + +let hacker2 = "Alina"; +let hacker3 = "Sergej"; + +//1.4 Print "The navigator's name is YYYY".// + +console.log(`The navigators are ${hacker2}, ${hacker3}`); + +/*Iteration 2: Conditionals +2.1. Depending on which name is longer, print: - The Driver has the longest name, it has XX characters or - Yo, navigator got the longest name, it has XX characters or - Wow, you both got equally long names, XX characters!*/ + +/*Iteration 3: Loops +3.1 Print all the characters of the driver's name, separated by a space and in capitals i.e. "J O H N"*/ + +//3.2 Print all the characters of the navigator's name, in reverse order. i.e. "nhoJ"// + +//3.3 Depending on the lexicographic order of the strings, print: - The driver's name goes first. - Yo, the navigator goes first definitely. - What?! You both got the same name?// + +/*Bonus Time! +Go to lorem ipsum generator and: + +Generate 3 paragraphs. Store the text in a variable type of string. +Make your program count the number of words in the string. +Make your program count the number of times the Latin word et appears.*/ \ No newline at end of file From f67e129703003aef07e5dd0827db92118fbba765 Mon Sep 17 00:00:00 2001 From: Gooss Date: Mon, 18 Nov 2019 17:19:41 +0100 Subject: [PATCH 3/4] Second iteration done --- index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 4258ecf29..80414431d 100644 --- a/index.js +++ b/index.js @@ -9,16 +9,25 @@ console.log(`The driver´s name is ${hacker1}`); //1.3 Create a variable hacker2 with the navigator's name.// -let hacker2 = "Alina"; -let hacker3 = "Sergej"; +let hacker2 = "AlinaSergej"; //1.4 Print "The navigator's name is YYYY".// -console.log(`The navigators are ${hacker2}, ${hacker3}`); +console.log(`The navigator´s name is ${hacker2}`); /*Iteration 2: Conditionals 2.1. Depending on which name is longer, print: - The Driver has the longest name, it has XX characters or - Yo, navigator got the longest name, it has XX characters or - Wow, you both got equally long names, XX characters!*/ +if (hacker1.length >=hacker2.length){ + if (hacker1.length == hacker2.length){ + console.log(`Wow, you both got equally long names, ${hacker1.length} characters!`) + } else { + console.log(`The Driver has the longest name, it has ${hacker1.length} characters`) + } +} else { + console.log(`Yo, navigator got the longest name, it has ${hacker2.length} characters`) +} + /*Iteration 3: Loops 3.1 Print all the characters of the driver's name, separated by a space and in capitals i.e. "J O H N"*/ From f05ded3785ee9c5c34bdc94eb432ae47fa8196f2 Mon Sep 17 00:00:00 2001 From: Gooss Date: Mon, 18 Nov 2019 18:08:16 +0100 Subject: [PATCH 4/4] Third iteration done --- index.js | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/index.js b/index.js index 80414431d..bf61179ba 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,18 @@ let hacker1 = "Juergen"; +//1.2 Print "The driver's name is XXXX".// + +console.log(`The driver´s name is ${hacker1}`); + +//1.3 Create a variable hacker2 with the navigator's name.// + +let hacker2 = "AlinaSergej"; +/*Iteration 1: Names and Input +1.1 Create a variable hacker1 with the driver's name.*/ +let hacker1 = "Juergen"; + + //1.2 Print "The driver's name is XXXX".// console.log(`The driver´s name is ${hacker1}`); @@ -31,6 +43,67 @@ if (hacker1.length >=hacker2.length){ /*Iteration 3: Loops 3.1 Print all the characters of the driver's name, separated by a space and in capitals i.e. "J O H N"*/ +let uppercasedDriver=hacker1.toUpperCase(); +/*let split=""; +. Solution: +for (let i = 0; i=hacker2.length){ + if (hacker1.length == hacker2.length){ + console.log(`Wow, you both got equally long names, ${hacker1.length} characters!`) + } else { + console.log(`The Driver has the longest name, it has ${hacker1.length} characters`) + } +} else { + console.log(`Yo, navigator got the longest name, it has ${hacker2.length} characters`) +} + +/*Iteration 3: Loops +3.1 Print all the characters of the driver's name, separated by a space and in capitals i.e. "J O H N"*/ + //3.2 Print all the characters of the navigator's name, in reverse order. i.e. "nhoJ"// //3.3 Depending on the lexicographic order of the strings, print: - The driver's name goes first. - Yo, the navigator goes first definitely. - What?! You both got the same name?//