forked from LaunchCodeEducation/javascript-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpart-three.js
More file actions
19 lines (14 loc) · 870 Bytes
/
part-three.js
File metadata and controls
19 lines (14 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//Part Three section one
let language = 'JavaScript';
let initials = language.slice(0,1)+language.slice(4,5);
//1. Use string concatenation and two slice() methods to print 'JS' from 'JavaScript'
console.log(language.slice(0,1)+language.slice(4,5));
//2. Without using slice(), use method chaining to accomplish the same thing.
console.log(language.replace("JavaScript", "JS"));
//3. Use bracket notation and a template literal to print, "The abbreviation for 'JavaScript' is 'JS'."
console.log(`The abbreviation for '${language}' is '${initials}'`);
//4. Just for fun, try chaining 3 or more methods together, and then print the result.
//Part Three section Two
//1. Use the string methods you know to print 'Title Case' from the string 'title case'.
let notTitleCase = 'title case';
console.log(notTitleCase.replace("title case", "Title Case"));