Skip to content

Commit 67a65d2

Browse files
committed
StringingCharactersTogether: Exercises P.3
1 parent 35bb7b8 commit 67a65d2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1+
12
//Part Three section one
23

34
let language = 'JavaScript';
45

56
//1. Use string concatenation and two slice() methods to print 'JS' from 'JavaScript'
67

8+
console.log(language.slice(0,1) + language.slice(4,5));
79
//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)
912
//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}'.`)
1115
//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} `)
1317
//Part Three section Two
1418

1519
//1. Use the string methods you know to print 'Title Case' from the string 'title case'.
1620

1721
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'));

0 commit comments

Comments
 (0)