-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring-slice.js
More file actions
34 lines (26 loc) · 778 Bytes
/
string-slice.js
File metadata and controls
34 lines (26 loc) · 778 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
33
34
// split
const anthum = 'Amar Sonar Bangla Ami Tomake Valobashi';
const words=anthum.split(' ');
// console.log(words);
// slice
const smallSlice = anthum.slice(0,10)
// console.log(smallSlice);
// substr
const anotherPart = anthum.substr(2,10)
// console.log(anotherPart);
// substring
const anotherAnotherPart = anthum.substring(2,10)
// console.log(anotherAnotherPart);
// concat
const first = 'Amar';
const second ='City';
// const fullString = first + second;
const fullString = first.concat(second).concat('@gmail')
// console.log(fullString);
// join()
const words2 = ['a','b','c','d'];
// const fullJoins = words2.join('');
// const fullJoins = words2.join(' ');
// const fullJoins = words2.join(',');
const fullJoins = words2.join(', ');
console.log(fullJoins);