Im working with sublime text and when ever i run the code it gives me "ReferenceError: document is not defined" can someone help?
here is the code:
const characters = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "~", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "-", "+", "=", "{", "[", "}", "]", ",", "|", ":", ";", "<", ">", ".", "?",
"/"
];
let boxoneEl = document.getElementById("boxOne-el")
let boxtwoEl = document.getElementById("boxTwo-el")
let Length = 15
function getPasswordNumbers() {
let randomIndexOne = Math.floor(Math.random() * characters.length)
return characters[randomIndexOne]
}
function generatePassword() {
let password1 = ""
let password2 = ""
for (let i = 0; i < Length; i++) {
password1 += getPasswordNumbers()
password2 += getPasswordNumbers()
}
boxoneEl.textContent = password1
boxtwoEl.textContent = password2
}
<html>
<head>
<link rel="stylesheet" href="PasswordGen.css">
</head>
<body>
<button onclick="generatePassword()"">Generate passwords</button>
<h1> Generate a</h1>
<h2>random password</h2>
<h3>Never use an insecure password again.</h3>
<h4 id="boxOne-el"></h4>
<h5 id="boxTwo-el"></h5>
<script src="PasswordGen.js"></script>
</body>
</html>
idattributes.<button onclick="generatePassword()"" >probably broke the code beautifier.