-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray_split.js
More file actions
51 lines (35 loc) · 1.77 KB
/
Copy patharray_split.js
File metadata and controls
51 lines (35 loc) · 1.77 KB
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
45
46
47
48
49
50
51
const string1 = `1,2,3,My,Name,is,Ney`
const arrayWithoutSeperator = string1.split()
console.log(arrayWithoutSeperator)
//[ '1,2,3,My,Name,is,Ney' ]
const array1 = string1.split(',')
console.log(array1)
//[ '1', '2', '3', 'My', 'Name', 'is', 'Ney' ]
const arrayWithLimit = string1.split(',', 4)
console.log(arrayWithLimit)
//[ '1', '2', '3', 'My' ]
console.log("=========================");
const string2 = `123MyNameisNey`
const array2 = string2.split('')
console.log(array2)
//[ '1', ',', '2', ',', '3', ',', 'M', 'y', ',', 'N', 'a', 'm', 'e', ',', 'i', 's', ',', 'N', 'e', 'y' ]
const string3 = `1,2,3,My,Name,is,Ney`
const array3 = string3.split(',')
console.log(array3) //[ '1', '2', '3', 'My', 'Name', 'is', 'Ney' ]
const string4 = `1and2and3andMyandNameandisandNey`
const array4 = string4.split('and')
console.log(array4) //[ '1', '2', '3', 'My', 'Name', 'is', 'Ney' ]
console.log("=========================");
const string5 = `1-2-3-My-Name-is-Ney`
const array5 = string5.split('-')
console.log(array5) //[ '1', '2', '3', 'My', 'Name', 'is', 'Ney' ]
const string6 = `1=2=3=My=Name=is=Ney`
const array6 = string6.split('=')
console.log(array6) //[ '1', '2', '3', 'My', 'Name', 'is', 'Ney' ]
const string7 = `1:2:3:My:Name:is:Ney`
const array7 = string7.split(':')
console.log(array7) //[ '1', '2', '3', 'My', 'Name', 'is', 'Ney' ]
const string8 = `1 2 3 My Name is Ney`
const array8 = string8.split(' ')
console.log(array8) //[ '1', '2', '3', 'My', 'Name', 'is', 'Ney' ]
console.log("=========================");