js中截取字符串前几位的方法时间:2025-02-15 14:22:32使用substring方法: let str = "Hello, World!"; let result = (0, 5); (result); // 输出: Hello