I am trying to get a file and assign it to a array and randomly get a string from the array and print it on the html. I have done this whole project in python. But I've never programmed with JavaScript and am not sure how to proceed. I think the issue may be with the file assigning to array but I am confused.
<!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>