I have a variable, email.
"Check to see if the email value property is at least 6 characters in length"
How do I do that? I dont even know what to google. I tried searching "require certain amount of characters in a string javascript" and couldnt find anything.
The closest thing I could find was to use indexOf. But still I couldnt find any examples using indexOf.
Heres what I have.
if (email != '' && email.indexOf(5) && email.indexOf("@")) {
I put 5 because one example I found was an array so I wasnt sure if it applied to this too. The other indexOf is to check if the string also contains @
You can do it as:
if(email != null && email.length > 5){
// Your code...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With