Skip to content

Commit 3355aef

Browse files
committed
Code added
1 parent ce4948b commit 3355aef

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

common-string-methods.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,46 @@ Complete the following tasks and assign the results to the specified variables.
6969
let inputString = " Welcome to the Coding Bootcamp! Learn JavaScript today. ";
7070

7171
// 1. Searching
72-
let hasJavaScript; // Your code here
72+
let hasJavaScript; // Your code here
73+
let hasJavaScript = inputString.includes("JavaScript");
74+
7375
let codingPosition; // Your code here
76+
let codingPosition = inputString.indexOf("Coding");
77+
7478
let startsWithWelcome; // Your code here
79+
let startsWithWelcome = inputString.trim().startsWith("Welcome");
80+
7581
let endsWithToday; // Your code here
82+
let endsWithToday = inputString.trim().endsWith("today.");
83+
7684

7785
// 2. Transforming
7886
let lowercaseString; // Your code here
87+
let lowercaseString = inputString.toLowerCase();
88+
7989
let uppercaseString; // Your code here
90+
let uppercaseString = inputString.toUpperCase();
91+
8092
let trimmedString; // Your code here
93+
let trimmedString = inputString.trim();
94+
8195
let replacedString; // Your code here
96+
let replacedString = inputString.replace("JavaScript","coding");
8297

8398
// 3. Breaking Apart
8499
let wordsArray; // Your code here
100+
let wordsArray = trimmedString.split(" ");
101+
85102

86103
// 4. Retrieving
87104
let firstCharacter; // Your code here
105+
let firstCharacter = trimmedString.charAt(0);
106+
88107
let extractedBootcamp; // Your code here
108+
let bootcampIndex = trimmedString.indexOf("Bootcamp");
109+
let extractedBootcamp = trimmedString.slice(bootcampIndex, bootcampIndex + "Bootcamp".length);
110+
111+
89112

90113
// Log all results
91114
console.log({

0 commit comments

Comments
 (0)