-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpassword.js
30 lines (29 loc) · 857 Bytes
/
password.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* @param {string} password
* @return {boolean}
*/
var strongPasswordCheckerII = function(password) {
if(password.length<8) return false
let spe = "!@#$%^&*()-+";
let lower = 0, bigger =0, num=0, special =0;
for(let i=0;i<password.length;i++){
let strcode = password[i].charCodeAt()
if(strcode>=65&&strcode<=90){
bigger++;
};
if(strcode>=97&&strcode<=122){
lower++;
};
if(parseInt(password[i])>=0&&parseInt(password[i])<=9){
num++;
};
if(spe.indexOf(password[i])>=0){
special++;
};
if(i<password.length&&password[i]===password[i+1]){
return false;
}
}
if(lower&&bigger&&num&&special) return true
};
strongPasswordCheckerII("ecuwcfoyajkolntovfniplayrxhzpmhrkhzonopcwxgupzhoupw");