📅  最后修改于: 2022-03-11 15:01:38.462000             🧑  作者: Mango
const str = "Learning to code";
// substring between index 2 and index 5
console.log(str.substring(2, 5));
// substring between index 0 and index 4
console.log(str.substring(0, 4));
// using substring() method without endIndex
console.log(str.substring(2));
console.log(str.substring(5));