-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweek-2-string.js
35 lines (30 loc) · 1.37 KB
/
week-2-string.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var word = 'JavaScript';
var second = 'is';
var third = 'awesome';
var fourth = 'and';
var fifth = 'I';
var sixth = 'love';
var seventh = 'it!';
console.log(`${word} ${second} ${third} ${fourth} ${fifth} ${sixth} ${seventh}`);
var word = 'wow JavaScript is so cool';
var exampleFirstWord = word[0] + word[1] + word[2];
var secondWord = `${word[4]}${word[5]}${word[6]}${word[7]}${word[8]}${word[9]}${word[10]}${word[11]}${word[12]}${word[13]}` ;
var thirdWord = `${word[15]}${word[16]}`; // do your own!
var fourthWord = `${word[18]}${word[19]}`; // do your own!
var fifthWord = `${word[21]}${word[22]}${word[23]}${word[24]}`; // do your own!
console.log('First Word: ' + exampleFirstWord);
console.log('Second Word: ' + secondWord);
console.log('Third Word: ' + thirdWord);
console.log('Fourth Word: ' + fourthWord);
console.log('Fifth Word: ' + fifthWord);
var word3 = 'wow JavaScript is so cool';
var exampleFirstWord3 = word.substring(0, 3);
var secondWord3 = word.substring(4, 14); // do your own!
var thirdWord3 = word.substring(15, 17); // do your own!
var fourthWord3 = word.substring(18, 20); // do your own!
var fifthWord3 = word.substring(21, 25); // do your own!
console.log('First Word: ' + exampleFirstWord3);
console.log('Second Word: ' + secondWord3);
console.log('Third Word: ' + thirdWord3);
console.log('Fourth Word: ' + fourthWord3);
console.log('Fifth Word: ' + fifthWord3);