Skip to content
Open

done! #124

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const string1 = "My favorite dessert is jello";

// Your code here...


console.log(string1.indexOf("j"));


/*******************************************
Expand All @@ -19,7 +19,11 @@ const string2 = "ABCDEFGHJKLO";

// Your code here...

console.log(string2.indexOf("C"));
console.log(string2.indexOf("O"));
console.log(string2.indexOf("L"));

console.log(string2[2] + string2[11] + string2[11] + string2[10]);


/*****************************************************
Expand All @@ -30,7 +34,7 @@ const string2 = "ABCDEFGHJKLO";
const string3 = "Na";

// Your code here...

console.log(string3.repeat(4) + " Batman!");



Expand All @@ -43,7 +47,9 @@ const fruit = "banana apple mango orange lemon kiwi watermelon grapes pear pinea

// Your code here...

favouriteFruit = fruit.indexOf("grapes");

console.log(fruit.slice(favouriteFruit, favouriteFruit + 6)); // "grapes"

/***************************************************
Iteration 5 | Check If Strings Include a Word
Expand All @@ -55,14 +61,22 @@ 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")) {
console.log(`${funnyHeadline1} - The string includes the word 'oxygen'`);
} else {
console.log(`${funnyHeadline1} - The string does not include the word 'oxygen'`);
}

// Check the second headline
// Your code here ...

if (funnyHeadline2.includes("oxygen")) {
console.log(`${funnyHeadline2} - The string includes the word 'oxygen'`);
} else {
console.log(`${funnyHeadline2} - The string does not include the word 'oxygen'`);
}


/*******************************************
Expand All @@ -75,7 +89,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.charAt(string4.length - 1));