How to Convert String to Array of Characters in JavaScript

Published Aug 24, 2020  ∙  Updated May 2, 2022

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']