Files
30-seconds-of-code/snippets/toCharArray.md
2022-06-07 20:25:20 +03:00

428 B

title, tags, expertise, cover, firstSeen, lastUpdated
title tags expertise cover firstSeen lastUpdated
String to character array string beginner blog_images/waving-over-lake.jpg 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']