Q:

Check how many times decimal occurred in the number?

var abc = 134.67.3.56;
There are 3 decimal present in the variable abc.
How to get this via javascript? As new to coding if anyone could suggest then it would be really helpful! Will it be possible without converting it into string.
Thanks in advance!

A:

Use split('.') to get the elements splitted with . and then get the length of the array.

var abc = "134.67.3.56";
var count = abc.split('.').length;
console.log(count);

