I've been working on a project in Python where I need to retrieve a file, store it in an array, and display a random string from the array on HTML. However, I have no experience with JavaScript and am unsure how to proceed. I suspect there may be an issue with assigning the file to the array, which is causing confusion.
<!doctype html>
<html>
<head>
<title>Julia Mount</title>
</head>
<body onload="ll()">
<style>
body{
background-color:lime;
}
#wat{
padding-top:auto;
margin: auto;
text-align:center;
}
</style>
<script type="text/javascript">
var fs = require("fs");
var text = fs.readFileSync("./mytext.txt");
var textByLine = text.split("\n")
var ll = ["wat","idk"
];
//stuff im trying
//var randomIndex = Math.floor(Math.random() * textArray.length);
//var randomElement = textArray[randomIndex];
//document.getElementById("ll").innerHTML = randomElement;
ll.toString();
//document.getElementById("ll").innerHTML = ll;
</script>
<h1 id="wat">I love </h1>
<p></p>
<script type="text/javascript">
document.write($ll)
</script>
</body>
</html>