问题1:function checkOtherChar(str) 与function checkOtherChar()这个区别是?为什么在里面加了str?
问题2:麻烦帮我详细解释下两个for循环代表什么意思和arr.length和str.length各指什么长度?谢谢
代码中的疑难代码:
function checkOtherChar(str)
{
//定义一个特殊符号的数组
var arr = ["*","&","<",">","$","\\","/"];
//循环比较:数组中的每一个字符,与用户名每一个字符进行比对
for(var i=0;i<arr.length;i++)
{
for(var j=0;j<str.length;j++)
{
if(arr[i]==str.charAt(j))
{
return true;
}
}
}
//如果没找到
return false;
}
Excuse me: What do the two for loops mean and what length and function do arr.length and str.length refer to each? checkOtherChar(str)-PHP Chinese website Q&A-Excuse me: What do the two for loops mean and arr.length and What length does str.length refer to and function checkOtherChar(str)-PHP Chinese website Q&A
Take a look and learn.