File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
stringing-characters-together/exercises Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change
1
+
1
2
//Part Three section one
2
3
3
4
let language = 'JavaScript' ;
4
5
5
6
//1. Use string concatenation and two slice() methods to print 'JS' from 'JavaScript'
6
7
8
+ console . log ( language . slice ( 0 , 1 ) + language . slice ( 4 , 5 ) ) ;
7
9
//2. Without using slice(), use method chaining to accomplish the same thing.
8
-
10
+ let language1 = ( language . charAt ( 0 ) ) + ( language . charAt ( 4 ) ) ;
11
+ console . log ( language1 )
9
12
//3. Use bracket notation and a template literal to print, "The abbreviation for 'JavaScript' is 'JS'."
10
-
13
+ let lng = 'JS'
14
+ console . log ( `"The abbreviation for '${ language } ' is '${ lng } '.` )
11
15
//4. Just for fun, try chaining 3 or more methods together, and then print the result.
12
-
16
+ console . log ( `"The ' ${ language } ' can be shown in different ways such as; ${ language1 } and ${ lng } ` )
13
17
//Part Three section Two
14
18
15
19
//1. Use the string methods you know to print 'Title Case' from the string 'title case'.
16
20
17
21
let notTitleCase = 'title case' ;
22
+ let notTitleCase2 = ( notTitleCase . slice ( 0 , 5 ) )
23
+ let notTitleCase3 = ( notTitleCase . slice ( 6 , 10 ) ) ;
24
+ console . log ( notTitleCase2 . replace ( 't' , 'T' ) , notTitleCase3 . replace ( 'c' , 'C' ) ) ;
You can’t perform that action at this time.
0 commit comments