a_tirtha
asked on
Calculate the no of alphabets in a string
Given a string, how is the total number of alphabets and numerics contained, calculated using javascript?
var strline ="Testing123";
var numbers=0;
var alphas =0;
for (var i=0; i<strline.length; i++)
{
if(strline.charAT(i) == number)numbers++;
if(strline.charAT(i) == alphabet)alphas ++;
}
alert ("Contains " + numbers + " number and "+ alphas + " alphabet characters");
Please advice.
var strline ="Testing123";
var numbers=0;
var alphas =0;
for (var i=0; i<strline.length; i++)
{
if(strline.charAT(i) == number)numbers++;
if(strline.charAT(i) == alphabet)alphas ++;
}
alert ("Contains " + numbers + " number and "+ alphas + " alphabet characters");
Please advice.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.