wiki/content/20201112102537-javascript_string_to_array_conversion.md

389 B

date id title
20201112 0efc7236-a6cb-402f-91f6-f05f038a4aa2 JavaScript String To Array Conversion

Description

Strings can be converted into arrays with the spread operator:

Syntax

const chars = [..."abc"];
console.log(chars); // Array(3) [ "a", "b", "c" ]