Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

string to char array in javascript

const string = 'hi there';

const usingSplit = string.split('');              
const usingSpread = [...string];
const usingArrayFrom = Array.from(string);
const usingObjectAssign = Object.assign([], string);

// Result
// [ 'h', 'i', ' ', 't', 'h', 'e', 'r', 'e' ]
Source by www.samanthaming.com #
 
PREVIOUS NEXT
Tagged: #string #char #array #javascript
ADD COMMENT
Topic
Name
3+6 =