function guid (l) {
if(l === undefined){
l = 32;
}
var ascii = '';
for(var x=0; x<l; x++){
var rnd = Math.floor(Math.random()*(122 - 48))+48;
var convert = String.fromCharCode(rnd);
if(!(convert.match(/[a-zA-Z0-9]/g))){
// how to return 'rnd' until the lenght of the parameter is complete
}else{
ascii += convert;
}
}
return ascii;
}
console.log(guid());
这是我的代码。你能告诉我如何执行我的if语句吗?我的输出现在基于rnd通过if语句的次数。如果在for循环中返回
Thak你非常:) –