1// the substring method returns a string out of another string
2
3const str = 'Mozilla';
4
5console.log(str.substring(1, 3));
6// expected output: "oz"
7
8console.log(str.substring(2));
9// expected output: "zilla"
10
1let anyString = 'Mozilla'
2
3// Displays 'M'
4console.log(anyString.substring(0, 1))
5console.log(anyString.substring(1, 0))
6
7// Displays 'Mozill'
8console.log(anyString.substring(0, 6))
9
10// Displays 'lla'
11console.log(anyString.substring(4))
12console.log(anyString.substring(4, 7))
13console.log(anyString.substring(7, 4))
14
15// Displays 'Mozilla'
16console.log(anyString.substring(0, 7))
17console.log(anyString.substring(0, 10))
18
1// zero-based index, 'end' is excluded from result
2myString.substring( start, end )