I want to output 2 different random array objects. This is what I got so far. But It only shows 1 output instead of 2. How is this possible? I want to output 2 different random array objects. This is what I got so far. But It only shows 1 output instead of 2. How is this possible?
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
var myArray = [
"Apples",
"Bananas",
"Pears"
];
var randomItem1 = myArray[Math.floor(Math.random()*myArray.length)];
var randomItem2 = myArray[Math.floor(Math.random()*myArray.length)];
document.getElementById("randomItem1").innerHTML=randomItem1;
document.getElementById("randomItem2").innerHTML=randomItem2;
</script>
<div id = "randomItem1"> </div>
<div id = "randomItem2"> </div>
</body>
</html>