forked from mulchy/JS-Peer-Challenge
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
44 lines (26 loc) · 721 Bytes
/
app.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
36
37
38
39
40
41
42
43
44
//
var pro = 'Hello World!';
// to get to 1
console.log(pro.indexOf('e'));
//to get NaN
console.log(Number(pro));
//to get ['H', 'e', 'l','l','o']
console.log(pro.slice(0, 5).split(''));
// to get "string"
console.log(typeof pro);
// to get 9
console.log(pro.slice(0,9).length);
// to get 'e'
console.log(pro.charAt(1));
// to get "HELLO WORLD!"
console.log(pro.toUpperCase());
// to get "Hello World?"
console.log(pro.replace('!', '?'));
//to get "'ello"
console.log(pro.slice(0, 5).replace('H', '\''));
//to get "!dlroW olleH"
console.log(pro.split('').reverse().join(''));
//to get "1111"
console.log(pro.slice(0,4).replace('Hell', '1111'));
//to get ["Hello", "World!"]
console.log(pro.split(' '));