📜  javascript代码示例中的子字符串

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

代码示例6
const str = "Learning to code";

// 3 ways to get substring in javascript
// 1. substring() method
// 2. slice() method
// 3. substr() method

console.log(str.substring(0, 5));
console.log(str.substring(0, 5));
console.log(str.substr(2, 5));