We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eee0dce commit abdf3d1Copy full SHA for abdf3d1
1 file changed
javascript-question/passwordValidation.js
@@ -0,0 +1,25 @@
1
+const passwordValidation = (password) => {
2
+ let hasLowerCase = false;
3
+ let hasUpperCase = false;
4
+ let hasDigit = false;
5
+ if (password.length < 8) {
6
+ return false;
7
+ }
8
+ for (let char of password) {
9
+ if (char.charCodeAt(0) >= 65 && char.charCodeAt(0) <= 97) {
10
+ hasLowerCase = true;
11
+ } else if (char.charCodeAt(0) >= 97 && char.charCodeAt(0) <= 122) {
12
+ hasUpperCase = true;
13
+ } else if(!isNaN(Number(char))){
14
+ hasDigit = true;
15
16
17
+ if (!hasLowerCase || !hasUpperCase || !hasDigit) {
18
19
20
+ return true;
21
+};
22
+
23
24
25
+console.log(passwordValidation("asdksajaAs"));
0 commit comments