Menu
I have been given a piece of code that validates passwords, but need to edit the code with correct variable names and indentations etc. here is the original code:
<script language = “javascript”>
function a()
{
var v1 = B.value;
var n1;
var n2 = 0;
for (n1= 0; n1 < v1.length; n1++)
{
if (v1.charAt(n1) == “@” )
{
n2++;
}
}
if ((n2 != 1) || v1.charAt(n1 – 1) != “7”)
{
alert( “Your e-mail address is incorrect”);
}
}
</script>
any ideas what the variables n1 and n2 are/ what they do?
struggling to figure it out