📜  Javascript 中的子字符串使用 substr - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:28.341000             🧑  作者: Mango

代码示例1
const str = "Learning to code";
// start index is 1, length is 4
console.log(str.substr(1, 10));
// start index is 3, length is 2
console.log(str.substr(3, 2));

// length not given
// string extract to end of the string
console.log(str.substr(5));