Hello,
I just finished working through Making new Strings from old parts and I would like help understanding the let name = input.slice(semiC + 1); part of the code.
for (let i = 0; i < stations.length; i++) {
let input = stations[i];
let code = input.slice(0,3);
let semiC = input.indexOf(’;’);
let name = input.slice(semiC + 1);
let result = code + ‘:’ + name;
Initially I thought let name = input.slice(semiC ); without the +1 was sufficient, given the following statement:
“…if you know that you want to extract all of the remaining characters in a string after a certain character, you don’t have to include the second parameter! Instead, you only need to include the character position from where you want to extract the remaining characters in a string.”
Specifically what is +1 referring to?
Thank you!