Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript array split empty string

const str = ' apple banana kiwi ';

const result = str.split(' ').filter(element => element);
console.log(result); //['apple', 'banana' , 'kiwi']
Source by bobbyhadz.com #
 
PREVIOUS NEXT
Tagged: #javascript #array #split #empty #string
ADD COMMENT
Topic
Name
6+8 =