From da70751fb4d49dc6d76a5b418d10b96285b020f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Pi=C3=B1a=20Grau?= Date: Fri, 10 Oct 2025 14:54:02 +0200 Subject: [PATCH 1/6] feat: iteration 1 --- index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index aa0a0fd..9c2bfc3 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,9 @@ const string1 = "My favorite dessert is jello"; -// Your code here... +const charPosition = string1.indexOf("j"); + +console.log(charPosition); @@ -35,7 +37,7 @@ const string3 = "Na"; /******************************************* - Iteration 4 | Fruite Slice + Iteration 4 | Fruite Slice *******************************************/ // Using the string method .slice(), access and print to the console the name of your favorite fruit from a given string @@ -66,7 +68,7 @@ const funnyHeadline2 = "Students Cook & Serve Grandparents"; /******************************************* - Iteration 6 | String Length + Iteration 6 | String Length *******************************************/ // Using console.log() print to the console the length of the string and the last character in the string. @@ -78,4 +80,4 @@ const string4 = "zEAWrTC9EgtxmK9w1"; // b) Print the last character in the string -// Your code here ... +// Your code here ... \ No newline at end of file From 7e92cf79f3d402f7a2c0cfa48af78c233511ffa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Pi=C3=B1a=20Grau?= Date: Fri, 10 Oct 2025 14:55:47 +0200 Subject: [PATCH 2/6] feat: iteration 2 --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 9c2bfc3..834fdb0 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,9 @@ console.log(charPosition); const string2 = "ABCDEFGHJKLO"; -// Your code here... +const newString = `${string2[string2.indexOf("C")]}${string2[string2.indexOf("O")]}${string2[string2.indexOf("O")]}${string2[string2.indexOf("L")]}`; + +console.log(newString); From 3d63f354b562418ddffb67e17d84c439fc62d07f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Pi=C3=B1a=20Grau?= Date: Fri, 10 Oct 2025 14:56:58 +0200 Subject: [PATCH 3/6] feat: iteration 3 --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 834fdb0..fed9444 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,11 @@ console.log(newString); const string3 = "Na"; -// Your code here... +const stringRepeat = string3.repeat(4); + +const batmanName = "Batman"; + +console.log(`${stringRepeat} ${batmanName}!`); From 161dbcd295c93c69fe1d67c8db4dbf404ae348a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Pi=C3=B1a=20Grau?= Date: Fri, 10 Oct 2025 14:58:42 +0200 Subject: [PATCH 4/6] feat: iteration 4 --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index fed9444..bd66354 100644 --- a/index.js +++ b/index.js @@ -49,7 +49,9 @@ console.log(`${stringRepeat} ${batmanName}!`); const fruit = "banana apple mango orange lemon kiwi watermelon grapes pear pineapple"; -// Your code here... +const myFavouriteFruit = fruit.slice(fruit.indexOf("pear"), fruit.indexOf("pear") + "pear".length); + +console.log(myFavouriteFruit); From 77ec86800c89971c8c0d444f15540fe86a6af44e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Pi=C3=B1a=20Grau?= Date: Fri, 10 Oct 2025 15:00:11 +0200 Subject: [PATCH 5/6] feat: iteration 5 --- index.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index bd66354..ccc4c06 100644 --- a/index.js +++ b/index.js @@ -66,12 +66,18 @@ const funnyHeadline1 = "Breathing oxygen linked to staying alive"; const funnyHeadline2 = "Students Cook & Serve Grandparents"; -// Check the first headline -// Your code here ... - - -// Check the second headline -// Your code here ... +if (funnyHeadline1.includes("oxygen")) { + console.log("The string includes the word 'oxygen'"); +} else { + console.log("The string does not include the word 'oxygen'"); +}; + + +if (funnyHeadline2.includes("oxygen")) { + console.log("The string includes the word 'oxygen'"); +} else { + console.log("The string does not include the word 'oxygen'"); +}; From 2af60a78e37c70e904c9fe4ea8004a8cfae6a954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Pi=C3=B1a=20Grau?= Date: Fri, 10 Oct 2025 15:01:25 +0200 Subject: [PATCH 6/6] feat: iteration 6 --- index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index ccc4c06..852c727 100644 --- a/index.js +++ b/index.js @@ -89,9 +89,7 @@ if (funnyHeadline2.includes("oxygen")) { const string4 = "zEAWrTC9EgtxmK9w1"; -// a) Print the string length -// Your code here ... +console.log(string4.length); -// b) Print the last character in the string -// Your code here ... \ No newline at end of file +console.log(string4[string4.length-1]); \ No newline at end of file