Skip to content

Commit 055117b

Browse files
Practice manipulating strings with built in functions.
1 parent ce4948b commit 055117b

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

common-string-methods.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,26 +66,25 @@ Complete the following tasks and assign the results to the specified variables.
6666
*/
6767

6868
//Starter Code
69-
let inputString = " Welcome to the Coding Bootcamp! Learn JavaScript today. ";
70-
69+
let inputString = " Welcome to the Coding Bootcamp! Learn JavaScript today. ";
7170
// 1. Searching
72-
let hasJavaScript; // Your code here
73-
let codingPosition; // Your code here
74-
let startsWithWelcome; // Your code here
75-
let endsWithToday; // Your code here
71+
let hasJavaScript = inputString.includes("JavaScript"); // Your code here
72+
let codingPosition = inputString.indexOf("Coding"); // Your code here
73+
let startsWithWelcome = inputString.startsWith("Welcome"); // Your code here
74+
let endsWithToday = inputString.endsWith("today."); // Your code here
7675

7776
// 2. Transforming
78-
let lowercaseString; // Your code here
79-
let uppercaseString; // Your code here
80-
let trimmedString; // Your code here
81-
let replacedString; // Your code here
77+
let lowercaseString = inputString.toLowerCase(); // Your code here
78+
let uppercaseString = inputString.toUpperCase(); // Your code here
79+
let trimmedString = inputString.trim(); // Your code here
80+
let replacedString = inputString.replace("JavaScript", "coding"); // Your code here
8281

8382
// 3. Breaking Apart
84-
let wordsArray; // Your code here
83+
let wordsArray = inputString.split(" "); // Your code here
8584

8685
// 4. Retrieving
87-
let firstCharacter; // Your code here
88-
let extractedBootcamp; // Your code here
86+
let firstCharacter = inputString.charAt(0); // Your code here
87+
let extractedBootcamp = inputString.replace("Bootcamp", "")// Your code here
8988

9089
// Log all results
9190
console.log({

0 commit comments

Comments
 (0)