scrimba
Prompt Engineering
AI Assisted Coding
Generate Test Cases
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

AboutCommentsNotes
Generate Test Cases
Expand for more info
passwordChecker.js
run
preview
console
/**
* Checks if a password is valid. A password is considered valid if it has a length
* of 10 or more characters, includes at least one capital letter, and contains
* at least one non-alphanumeric character.
*
* @param {string} password - The password to be checked.
* @returns {boolean} - Returns true if the password is valid, otherwise returns false.
*/
function passwordChecker(password) {
const minLength = 10;
const capitalLetter = /[A-Z]/;
const nonAlphanumeric = /[^a-zA-Z0-9]/;

if (password.length >= minLength &&
capitalLetter.test(password) &&
nonAlphanumeric.test(password)) {
return true;
} else {
return false;
}
}
Console
/index.html
-4:42