Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Splitting a text using javascript

Tags:

javascript

Hi I am having string called 'santhosh'. I wish to split this text as 's,a,n,t,h,o,s,h' using javascript. Is it possible? And want to save it in an array.

And I wish to check whether the splitted character is string or Numeric is it possible?

like image 648
susanthosh Avatar asked Jan 18 '26 06:01

susanthosh


1 Answers

You can use an empty string as the separator argument of the split method:

var array = "santhosh".split('');
// ["s", "a", "n", "t", "h", "o", "s", "h"]
like image 112
Christian C. Salvadó Avatar answered Jan 20 '26 18:01

Christian C. Salvadó