You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
451 B
9 lines
451 B
5 years ago
|
// 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
|