Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

convert string to array 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: #convert #string #array #javascript
ADD COMMENT
Topic
Name
8+1 =