@@ -69,23 +69,46 @@ Complete the following tasks and assign the results to the specified variables.
69
69
let inputString = " Welcome to the Coding Bootcamp! Learn JavaScript today. " ;
70
70
71
71
// 1. Searching
72
- let hasJavaScript ; // Your code here
72
+ let hasJavaScript ; // Your code here
73
+ let hasJavaScript = inputString . includes ( "JavaScript" ) ;
74
+
73
75
let codingPosition ; // Your code here
76
+ let codingPosition = inputString . indexOf ( "Coding" ) ;
77
+
74
78
let startsWithWelcome ; // Your code here
79
+ let startsWithWelcome = inputString . trim ( ) . startsWith ( "Welcome" ) ;
80
+
75
81
let endsWithToday ; // Your code here
82
+ let endsWithToday = inputString . trim ( ) . endsWith ( "today." ) ;
83
+
76
84
77
85
// 2. Transforming
78
86
let lowercaseString ; // Your code here
87
+ let lowercaseString = inputString . toLowerCase ( ) ;
88
+
79
89
let uppercaseString ; // Your code here
90
+ let uppercaseString = inputString . toUpperCase ( ) ;
91
+
80
92
let trimmedString ; // Your code here
93
+ let trimmedString = inputString . trim ( ) ;
94
+
81
95
let replacedString ; // Your code here
96
+ let replacedString = inputString . replace ( "JavaScript" , "coding" ) ;
82
97
83
98
// 3. Breaking Apart
84
99
let wordsArray ; // Your code here
100
+ let wordsArray = trimmedString . split ( " " ) ;
101
+
85
102
86
103
// 4. Retrieving
87
104
let firstCharacter ; // Your code here
105
+ let firstCharacter = trimmedString . charAt ( 0 ) ;
106
+
88
107
let extractedBootcamp ; // Your code here
108
+ let bootcampIndex = trimmedString . indexOf ( "Bootcamp" ) ;
109
+ let extractedBootcamp = trimmedString . slice ( bootcampIndex , bootcampIndex + "Bootcamp" . length ) ;
110
+
111
+
89
112
90
113
// Log all results
91
114
console . log ( {
0 commit comments