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

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

代码示例1
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));