9 lines
451 B
9 lines
451 B
// substring(): It takes two arguments,the starting index and the stopping index but it doesn't include the stopping index.
|
|
let string = 'JavaScript'
|
|
console.log(string.substring(0,4)) // Java
|
|
console.log(string.substring(4,10)) // Script
|
|
console.log(string.substring(4)) // Script
|
|
let country = 'Finland'
|
|
console.log(country.substring(0, 3)) // Fin
|
|
console.log(country.substring(3, 7)) // land
|
|
console.log(country.substring(3)) // land
|