1
const checkLen = (password) => password.length >= 8;
2

3
const checkSmallLetter = (password) => {
4
for (let i = 0; i < password.length; i++) {
5
const ind = password.charCodeAt(i);
6
if (ind > 96 && ind < 123) {
7
return true;
8
}
9
}
10
return false;
11
};
12

13
const checkCapitalLetter = (password) => {
14
for (let i = 0; i < password.length; i++) {
15
const ind = password.charCodeAt(i);
16
if (ind > 64 && ind < 91) {
17
return true;
18
}
19
}
20
return false;
21
};
22

23
const checkDigit = (password) => {
24
for (let i = 0; i < password.length; i++) {
25
const ind = password.charCodeAt(i);
26
if (ind > 47 && ind < 58) {
27
return true;
28
}
29
}
30
return false;
31
};
32

33
const checkSpecialChar = (password) => {
34
const str = "!@#$%^&*()-+";
35
for (let i = 0; i < str.length; i++) {
36
if (password.includes(str[i])) return true;
37
}
38
return false;
39
};
40

41
const checkAdjacentMatches = (password) => {
42
for (let i = 1; i < password.length; i++) {
43
if (password[i] === password[i - 1]) return false;
44
}
45
return true;
46
};
47

48
var strongPasswordCheckerII = function (password) {
49
const lenValidity = checkLen(password);
50
const smallLetterValidity = checkSmallLetter(password);
51
const capitalLetterValidity = checkCapitalLetter(password);
52
const digitValidity = checkDigit(password);
53
const specialCharValidity = checkSpecialChar(password);
54
const adjacentMatchesValidity = checkAdjacentMatches(password);
55

56
const passwordIsStrong =
57
lenValidity &&
58
smallLetterValidity &&
59
capitalLetterValidity &&
60
digitValidity &&
61
specialCharValidity &&
62
adjacentMatchesValidity;
63

64
return passwordIsStrong;
65
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0