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
32 changes: 20 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@
// Write code that prints out to the console the index of the character “j” in

const string1 = "My favorite dessert is jello";

const findJ = string1.indexOf("j");
console.log(findJ);
// Your code here...




/*******************************************
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";
const cool = string2[2] + string2[11] + string2[11] + string2[10];

// Your code here...

console.log(cool);



Expand All @@ -30,19 +31,20 @@ const string2 = "ABCDEFGHJKLO";
const string3 = "Na";

// Your code here...



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

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

const ourFavoriteFruit = "kiwi";
/*const beginning = ourFavoriteFruit.indexOf(ourFavoriteFruit);
const end = beginning + ourFavoriteFruit.length;
*/
// Your code here...

console.log (ourFavoriteFruit.slice(0, ourFavoriteFruit.length));


/***************************************************
Expand All @@ -58,11 +60,17 @@ 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'")}


/*******************************************
Expand All @@ -75,7 +83,7 @@ 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]);