From 6d39bc1b0e9beb04a0e54b6e421ce13790697cb2 Mon Sep 17 00:00:00 2001 From: sosina14 Date: Mon, 7 Apr 2025 02:35:39 +0300 Subject: [PATCH 1/7] DONE --- index.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 index.js diff --git a/index.js b/index.js new file mode 100644 index 0000000..b3a5524 --- /dev/null +++ b/index.js @@ -0,0 +1 @@ +console.log("I'm ready!") From 2a939f88be79b9213f9255ec5f12eb63fea712b0 Mon Sep 17 00:00:00 2001 From: sosina14 Date: Wed, 9 Apr 2025 23:32:42 +0300 Subject: [PATCH 2/7] Iteration 1 Nmae and Input --- index.js | 17 +++++++++++++++++ js/index.js | 12 +++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index b3a5524..c90f303 100644 --- a/index.js +++ b/index.js @@ -1 +1,18 @@ console.log("I'm ready!") + +// Iteration 1: Names and Input + +//Iteration 1: Names and Input +//1.1 Create a variable hacker1 with the driver's name. +let hacker1 = "Abel" +//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 = "Abebe" +//1.4 Print "The navigator's name is YYYY". +console.log("The driver's name is " + hacker2) + +// Iteration 2: Conditionals + + +// Iteration 3: Loops diff --git a/js/index.js b/js/index.js index 59e4af7..56a24fa 100644 --- a/js/index.js +++ b/js/index.js @@ -1,5 +1,15 @@ // Iteration 1: Names and Input -// + +//Iteration 1: Names and Input +//1.1 Create a variable hacker1 with the driver's name. +let hacker1 = "Abel" +//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 = "Abebe" +//1.4 Print "The navigator's name is YYYY". +console.log("The driver's name is " + hacker2) + // Iteration 2: Conditionals From 3115692868f115bddd05f0132040137c9de898d1 Mon Sep 17 00:00:00 2001 From: sosina14 Date: Wed, 9 Apr 2025 23:34:11 +0300 Subject: [PATCH 3/7] Iteration 1 Nmae and Input --- js/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/index.js b/js/index.js index 56a24fa..c90f303 100644 --- a/js/index.js +++ b/js/index.js @@ -1,3 +1,5 @@ +console.log("I'm ready!") + // Iteration 1: Names and Input //Iteration 1: Names and Input From 9fdc92a6710de17e924dbd539303cd7cc3d770ec Mon Sep 17 00:00:00 2001 From: sosina14 Date: Wed, 9 Apr 2025 23:58:24 +0300 Subject: [PATCH 4/7] Iteration 2 condition --- js/index.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/js/index.js b/js/index.js index c90f303..8f57c6b 100644 --- a/js/index.js +++ b/js/index.js @@ -1,18 +1,25 @@ -console.log("I'm ready!") - -// Iteration 1: Names and Input - //Iteration 1: Names and Input //1.1 Create a variable hacker1 with the driver's name. let hacker1 = "Abel" //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 = "Abebe" +let hacker2 = "Abebeee" //1.4 Print "The navigator's name is YYYY". console.log("The driver's name is " + hacker2) -// Iteration 2: Conditionals - +//Iteration 2: Conditionals +//2.1. Depending on which name is longer, print: +//The driver has the longest name, it has XX characters. or +let a = (hacker1.length) +let b = (hacker2.length) -// Iteration 3: Loops +if (a < b) { + console.log("It seems that the navigator has the longest name, It has "+ hacker2.length + " Characters."); +} else if (a > b) { + console.log("The driver has the longest name ,It has "+ hacker1.length + " Characters."); +} else { + console.log("Wow, you both have equally long names," + hacker1.length +" characters. " ); +} +//It seems that the navigator has the longest name, it has XX characters. or +//Wow, you both have equally long names, XX characters!. \ No newline at end of file From 7e79105a79233f5029eca9a1eaa32b1c1856c7d6 Mon Sep 17 00:00:00 2001 From: sosina14 Date: Thu, 10 Apr 2025 00:19:50 +0300 Subject: [PATCH 5/7] Iteration 3 loops --- js/index.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/js/index.js b/js/index.js index 8f57c6b..424abfc 100644 --- a/js/index.js +++ b/js/index.js @@ -22,4 +22,23 @@ if (a < b) { console.log("Wow, you both have equally long names," + hacker1.length +" characters. " ); } //It seems that the navigator has the longest name, it has XX characters. or -//Wow, you both have equally long names, XX characters!. \ No newline at end of file +//Wow, you both have 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" +//hacker1.[0]; +"cat".charAt(1); + +//hacker1.charAt(2); +"cat"[1]; +for(int i = 0 ; i > ){ + console.log +} +//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 have the same name? \ No newline at end of file From fd24f9278390c60e141abe597da0071a075f234c Mon Sep 17 00:00:00 2001 From: sosina14 Date: Fri, 11 Apr 2025 21:25:21 +0300 Subject: [PATCH 6/7] Iteration 3 loops --- index.js | 16 ---------------- js/index.js | 28 ++++++++++++++-------------- 2 files changed, 14 insertions(+), 30 deletions(-) diff --git a/index.js b/index.js index c90f303..61816d2 100644 --- a/index.js +++ b/index.js @@ -1,18 +1,2 @@ console.log("I'm ready!") -// Iteration 1: Names and Input - -//Iteration 1: Names and Input -//1.1 Create a variable hacker1 with the driver's name. -let hacker1 = "Abel" -//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 = "Abebe" -//1.4 Print "The navigator's name is YYYY". -console.log("The driver's name is " + hacker2) - -// Iteration 2: Conditionals - - -// Iteration 3: Loops diff --git a/js/index.js b/js/index.js index 424abfc..e034502 100644 --- a/js/index.js +++ b/js/index.js @@ -26,19 +26,19 @@ if (a < b) { //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" -//hacker1.[0]; -"cat".charAt(1); +//3.1 Print driver's name with spaces and in capitals +let driverNameWithSpaces = driver.toUpperCase().split('').join(' '); +console.log(driverNameWithSpaces); // Output: "J O H N" -//hacker1.charAt(2); -"cat"[1]; -for(int i = 0 ; i > ){ - console.log -} -//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. +// 3.2 Print navigator's name reversed +let navigatorNameReversed = navigator.split('').reverse().join(''); +console.log(navigatorNameReversed); // Output: "enaJ" -//Yo, the navigator goes first definitely. - -//What?! You both have the same name? \ No newline at end of file +// 3.3 Compare lexicographic order +if (driver.localeCompare(navigator) < 0) { + console.log("The driver's name goes first."); +} else if (driver.localeCompare(navigator) > 0) { + console.log("Yo, the navigator goes first definitely."); +} else { + console.log("What?! You both have the same name?"); +} \ No newline at end of file From 67fa1873c8d362463bf766560ebddb0950a14f8f Mon Sep 17 00:00:00 2001 From: sosina14 Date: Fri, 11 Apr 2025 21:26:33 +0300 Subject: [PATCH 7/7] Iteration 3 loops --- js/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/index.js b/js/index.js index e034502..932073a 100644 --- a/js/index.js +++ b/js/index.js @@ -26,15 +26,19 @@ if (a < b) { //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.1 Print driver's name with spaces and in capitals +// 3.1 Print driver's name with spaces and in capitals let driverNameWithSpaces = driver.toUpperCase().split('').join(' '); console.log(driverNameWithSpaces); // Output: "J O H N" // 3.2 Print navigator's name reversed +//3.2 Print all the characters of the navigator's name, in reverse order. i.e. "nhoJ" let navigatorNameReversed = navigator.split('').reverse().join(''); console.log(navigatorNameReversed); // Output: "enaJ" // 3.3 Compare lexicographic order +//3.3 Depending on the lexicographic order of the strings, print: +//The driver's name goes first. + if (driver.localeCompare(navigator) < 0) { console.log("The driver's name goes first."); } else if (driver.localeCompare(navigator) > 0) {