Files
30-seconds-of-code/snippets/js/s/to-character-array.md
Angelos Chalaris 9d032ce05e Rename js snippets
2023-05-19 20:23:47 +03:00

393 B

title, type, language, tags, cover, dateModified
title type language tags cover dateModified
String to character array snippet javascript
string
waving-over-lake 2020-10-08T15:17:22+03:00

Converts a string to an array of characters.

  • Use the spread operator (...) to convert the string into an array of characters.
const toCharArray = s => [...s];
toCharArray('hello'); // ['h', 'e', 'l', 'l', 'o']