guys, I'm new to Javascript and I understand everything in this code through research, however, I don't understand what the [9] and [12] lines actually do to the code. My guess is that it calls id"msg" when the button is pressed but then what does that do? All help is appreciated.
<!DOCTYPE html>
<html>
<body>
<p>Click the button to sort the array.</p>
<button onclick="RearrangeArray()">Rearrange Array</button>
<p id="msg"></p>
<script>
var products = ["Printer", "Tablet", "Router", "Computer","TV"];
document.getElementById("msg").innerHTML = products;
function RearrangeArray() {
products.sort();
document.getElementById("msg").innerHTML = products;
}
</script>
</body>
</html>