Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const password = prompt('buat password');
- let regex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@.#$!%*?&])[A-Za-z\d@.#$!%*?&]{8,15}$/;
- if (
- password.length >= 6 &&
- password.indexOf(' ') === -1 &&
- regex.test(password)
- ) {
- console.log('Password valid');
- } else {
- console.log('Password tidak memenuhi syarat');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement