function randomPassword(length) { const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefjhijklmnopqrstuvwxyz1234567890-_=+)(*&^%$#@!~/><?}{"; const charsLength = chars.length; let randomPassword = ''; for (let i = 0; i < length; i++) { randomPassword += chars.charAt(Math.floor(Math.random() * charsLength)); } return randomPassword; } // Example console.log(randomPassword(8)); // OutPut = Ju8-P)-w