Files
30-seconds-of-code/snippets/toCharArray.md
2022-02-13 19:19:45 +02:00

377 B

title, tags, firstSeen, lastUpdated
title tags firstSeen lastUpdated
String to character array string,beginner 2020-10-08T15:17:22+03:00 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']