if(password.search(/[0-9]/)){
document.getElementById('fpasswords').innerHTML="*atleast one numeric character";
return false;
}
here i used regex but i don’t want to use it so what’s the solution?
>Solution :
You can check each character with the function isNaN, this function returns false is it’s a numeric character and true if it’s not:
const str = 'Papayas1';
for (var i = 0; i < str.length; i++) {
if(!isNaN(str.charAt(i))) console.log('this is a number')
else console.log('this is not a number')
}