-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring3.js
More file actions
33 lines (23 loc) · 968 Bytes
/
Copy pathstring3.js
File metadata and controls
33 lines (23 loc) · 968 Bytes
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
let text1 = "Hello";
let text2 = "World";
let text3 = text1.concat(" ", text2);
console.log("Concatenated text3:", text3);
text2 = "Hello" + " " + "World!";
console.log("Concatenated text2 using +:", text2);
text = "Hello".concat(" ", "World!");
console.log("Concatenated text using + and concat():", text);
let text4 = "Apple, Banana, Kiwi";
let part = text4.slice(7, 13);
console.log("Sliced part of text4:", part);
let part2 = text4.slice(7);
console.log("Sliced part2 of text4 from index 7 to end:", part2);
let part3 = text4.slice(-12);
console.log("Sliced part3 of text4 from index -12 to end:", part3);
let part4 = text4.slice(-12,-6);
console.log("Sliced part4 of text4 from index -12 to -6:", part4);
let part5 = text4.substring(7,13);
console.log("Substring part5 of text4:", part5);
let part6 = text4.substring(7,6);
console.log("Substring part6 of text4:", part6);
let part7 = text4.substring(7);
console.log("Substring part7 of text4:", part7);