Start your developer blog today!
Email me

How to Convert String to Array of Characters in JavaScript

Aug 24, 2020 1 min read

ES6 (ES2015) introduced the spread operator ..., which essentially dumps the contents of an array, object, and even string.

We can declare an array and use the spread operator to dump each character of the string into the array.

const dog = 'corgi'
const converted = [ ...dog ] // ['c', 'o', 'r', 'g', 'i']

More JavaScript Articles