logo
  • Home
  • Contact
💵
Should I be buying I-Bonds in 2023?
💰
Need a step-by-step guide to opening your Roth IRA?
Buy me a coffee Buy me a coffee
aws c++ career cli css docker finance git java js misc python sql

How to Convert String to Array of Characters in JavaScript


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

Related in JS

How to Validate a UUID with Regular Expressions in JavaScript
How to Print All Properties of an Object to JSX in React.js
How to Allow target="blank" in DOMPurify.sanitize()
How to Replace All URLs in a String with Links (Anchor Tags) in JavaScript
How to Remove the Last Character from a String in JavaScript
How to Add Script Tag to HTML DOM from JavaScript
How to Get a Website User's Location in JavaScript
How to Convert Array of Objects to Hash Map By Key in JavaScript
How to Check if Dates are on the Same Day in JavaScript
How to Get User ID from Session in NextAuth (with or without JWTs)
How to Insert To and Delete From Arrays in Prisma
How to Create a Tooltip using TailwindCSS in JavaScript
How to Redirect Page from getServerSideProps or getStaticProps in Next.js
How to Add Google Analytics to a Next.js Application (including TypeScript)
How to Test JavaScript Web Applications on Mobile Without Deploying (in 1 minute!)
How to Add Placeholder to Listbox Select Element in Headless UI
© , LogFetch   âˆ™   Advertise Here   âˆ™   Privacy Policy