function generatePassword() {
const length = parseInt(document.getElementById(‘length’).value);
const includeUpper = document.getElementById(‘includeUpper’).checked;
const includeLower = document.getElementById(‘includeLower’).checked;
const includeNumbers = document.getElementById(‘includeNumbers’).checked;
const includeSymbols = document.getElementById(‘includeSymbols’).checked;let characterSet = ”;
if (includeUpper) characterSet += ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’;
if (includeLower) characterSet += ‘abcdefghijklmnopqrstuvwxyz’;
if (includeNumbers) characterSet += ‘0123456789’;
if (includeSymbols) characterSet += ‘!@#$%^&*()_+[]{}|;:,.?’;if (characterSet.length === 0) {
alert(‘Please select at least one character type.’);
return;
}let password = ”;
for (let i = 0; i < length; i++) {
const randomIndex = Math.floor(Math.random() * characterSet.length);
password += characterSet[randomIndex];
}document.getElementById('generatedPassword').innerText = password;
}
Visited 1 times, 1 visit(s) today
Comments are closed.
ICT BYTE is the ultimate youth-centric destination for tech news in Nepal. Delivering timely updates on the tech landscape within Nepal and beyond, it offers comprehensive coverage, in-depth analysis, and product reviews.
Contact Us ictbyte.com@gmail.com
44600 Way to St. Xavier's Maitighar, Kathmandu Nepal