+ 1
Counting of comas
hello what is the code/script for counting the comas in a given lines a,b,c,d,e,f,g,h,I,j I want to count number of comas in the above line. what is the scrip(JavaScript) to count the comas
3 odpowiedzi
+ 8
JavaScript:
alert(prompt("").split(",").length - 1);
+ 2
try this...
var i="a,b,c,d,e";
alert(i.split(',').length-1);
0
console.log('a,b,c,d,e,f,g,h,I,j'.match(/,/g).length);