概要
文字列を任意の箇所で切り取ることができます。
i番目から次の文字からj番目までを切り取ります。
substring(i,j) //jは省略可能
let hello = "hello";
//指定した番号から切り取ります
console.log(hello.substring(1)); //ello
console.log(hello.substring(4)); //o
console.log(hello.substring(0, 1)); //h
console.log(hello.substring(1, 3)); //hel
//lengthを使用
console.log(hello.substring(0, hello.length)); //hello
console.log(hello.substring(0, hello.length -1)); //hell
console.log(hello.substring(2, hello.length -1)); //ll
###参考
MDN substring