Skip to content
Open
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
53 changes: 24 additions & 29 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,46 @@

const string1 = "My favorite dessert is jello";

// Your code here...



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

/*******************************************
Iteration 2 | Concatenate Characters
*******************************************/
// Make a new string with the text "COOL" by using only the characters available in the provided string and the bracket notation

const string2 = "ABCDEFGHJKLO";
let c = string2.slice(2, 3);
let o = string2.slice(11);
let l = string2.slice(10, 11);

// Your code here...


let cool = `${c} ${o} ${o} ${l}`;

console.log(cool);

/*****************************************************
Iteration 3 | Repeat a String and Concatenate
*****************************************************/
// Using the method .repeat() and the provided string, print out the text "NaNaNaNa Batman!" in the console.

const string3 = "Na";
const batman = string3.repeat(3) + "" + "Batman!";

// Your code here...


console.log(batman);

// Your code here...

/*******************************************
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

const fruit = "banana apple mango orange lemon kiwi watermelon grapes pear pineapple";

// Your code here...
const fruit =
"banana apple mango orange lemon kiwi watermelon grapes pear pineapple";

const favFruit = fruit.slice(13, 18);
console.log(favFruit);

// Your code here...

/***************************************************
Iteration 5 | Check If Strings Include a Word
Expand All @@ -55,27 +56,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 ...


// Check the second 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'");
}

/*******************************************
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.

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.slice(16));