Skip to content

Files

Latest commit

7baeb65 · May 22, 2023

History

History
19 lines (13 loc) · 399 Bytes

toCharArray.md

File metadata and controls

19 lines (13 loc) · 399 Bytes
标题 标签
toCharArray(字符串转数组) string(字符串)

将字符串转换为字符数组。

  • 使用扩展运算符 (...) 将字符串转换为字符数组。
const toCharArray = s => [...s];

调用方式:

toCharArray('hello'); // ['h', 'e', 'l', 'l', 'o']

应用场景