JavaScirpt | String Function (三)
1.split
// split(separator, limit) separator为分隔符;limit为已经有 limit 个元素时停止分割
const str = 'The quick brown fox jumps over the lazy dog.';
const words = str.split(' ');
console.log(words[3]);
// Expected output: "fox"
const chars = str.split('');
console.log(chars[8]);
// Expected output: "k"
本文来自博客园,作者:两块五的菜鸟,转载请注明原文链接:https://www.cnblogs.com/rushintocloud/p/17952926