In the "substring" method, the second parameter is optional. If you don't include a second parameter then it just extracts the rest of the string.
The required parameter, in our case the "1" (
.substring(1)) says to start the extraction from index 1, thereby eliminating the first character at index 0.
let x = "This is a string" x = x.substring(1); console.log(x); // "his is a string"
Remove first x number of chars in a String
You can use this pattern to extract the first X number of characters of a string. For example, to remove the first 5 characters just do
let x = "This is a string" x = x.substring(5); console.log(x); // "is a string"