javascript exploser
//split into array of strings.
var str = "Well, how, are , we , doing, today";
var res = str.split(",");
Grepper
//split into array of strings.
var str = "Well, how, are , we , doing, today";
var res = str.split(",");
var str = "This is an amazing sentence.";
var words = str.split(" ");
console.log(words);
//["This", "is", "an", "amazing", "sentence."]
var myString = "An,array,in,a,string,separated,by,a,comma";
var myArray = myString.split(",");
/*
*
* myArray :
* ['An', 'array', 'in', 'a', 'string', 'separated', 'by', 'a', 'comma']
*
*/
let countWords = function(sentence){
return sentence.split(' ').length;
}
console.log(countWords('Type any sentence here'));
//result will be '4'(for words in the sentence)