Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
function validatePassword(password) { let isValid = true; //check length if (password.length < 6 || password.length > 10) { console.log("Password must be between 6 and 10 characters"); isValid = false; } //check special symbols let format = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/; let containsSpecial = false; containsSpecial = format.test(password); if (containsSpecial) { console.log("Password must consist only of letters and digits"); isValid = false; } //check number of digits let numbers = /[1234567890]/; let numbersCount = 0; let arr = password.split(""); let containsNumber = false; //check if contains numbers for (let symb of arr) { containsNumber = numbers.test(symb); if (containsNumber) { numbersCount++; } } if (numbersCount < 2) { isValid = false; console.log("Password must have at least 2 digits"); } if (isValid) { console.log("Password is valid"); } }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)