diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..6f3a291 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file diff --git a/index.js b/index.js index aa0a0fd..8245bca 100644 --- a/index.js +++ b/index.js @@ -5,10 +5,9 @@ const string1 = "My favorite dessert is jello"; -// Your code here... - - +// Your code +console.log(string1.indexOf(`j`)) /******************************************* Iteration 2 | Concatenate Characters @@ -19,6 +18,9 @@ const string2 = "ABCDEFGHJKLO"; // Your code here... +word = string2[2] + string2[11] + string2[11] + string2[10] + +console.log(word) @@ -31,7 +33,7 @@ const string3 = "Na"; // Your code here... - +console.log(`${string3.repeat(4)} Batman!`) /******************************************* @@ -43,7 +45,7 @@ const fruit = "banana apple mango orange lemon kiwi watermelon grapes pear pinea // Your code here... - +console.log(fruit.slice(0,6)) /*************************************************** Iteration 5 | Check If Strings Include a Word @@ -58,12 +60,22 @@ const funnyHeadline2 = "Students Cook & Serve Grandparents"; // Check the first 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'`) +} // Check the second headline // Your code here ... - +if (funnyHeadline2.includes('oxygen')) { + console.log(`The string includes the word 'oxygen'`); +} +else { + console.log(`The string does not include the word 'oxygen'`) +} /******************************************* Iteration 6 | String Length @@ -75,7 +87,8 @@ 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[string4.length-1]) \ No newline at end of file