diff --git a/index.js b/index.js index aa0a0fd..8d3af7c 100644 --- a/index.js +++ b/index.js @@ -6,7 +6,7 @@ const string1 = "My favorite dessert is jello"; // Your code here... - +console.log (string1.indexOf("jello")); @@ -18,7 +18,9 @@ const string1 = "My favorite dessert is jello"; const string2 = "ABCDEFGHJKLO"; // Your code here... +const newString = string2[2]+string2[11]+string2[11]+string2[10]; +console.log (newString); @@ -30,9 +32,9 @@ const string2 = "ABCDEFGHJKLO"; const string3 = "Na"; // Your code here... +const stringThree = "Na".repeat(4); - - +console.log (stringThree + " Batman!"); /******************************************* Iteration 4 | Fruite Slice @@ -42,9 +44,9 @@ const string3 = "Na"; const fruit = "banana apple mango orange lemon kiwi watermelon grapes pear pineapple"; // Your code here... +const myFavoriteFruit = fruit.slice(0,6); - - +console.log (myFavoriteFruit); /*************************************************** Iteration 5 | Check If Strings Include a Word ***************************************************/ @@ -55,14 +57,21 @@ const fruit = "banana apple mango orange lemon kiwi watermelon grapes pear pinea const funnyHeadline1 = "Breathing oxygen linked to staying alive"; const funnyHeadline2 = "Students Cook & Serve Grandparents"; - // Check the first headline // Your code here ... - +if (funnyHeadline1.includes("oxygen") === true) { + console.log ("The string includes the word 'oxygen'") +} else { + console.log ("The string does not include the word 'oxygen'") +} // Check the second headline // Your code here ... - +if (funnyHeadline2.includes("oxygen") === true) { + console.log ("The string includes the word 'oxygen'") +} else { + console.log ("The string does not include the word 'oxygen'") +} /******************************************* @@ -75,7 +84,9 @@ 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 ... +console.log (string4[16]); +