Q:

Why does  make a new line and \n fails to in JS

I am coding a simple javascript program, and I found that when I use \n in the document.write("");, it doesn't make a new line. When I use the <br> tag it works.
I want to know why \n fails to make a new line and <br> makes one.
Note: I am completely new to Javascript...
My Javascript using br:
<head>
    <style>
    </style>
</head>

<body>
<h1>Foo App</h1>

<script charset="utf-8">
  var input = null;

        input = prompt("Enter something: ");

        for (var i = 0; i < 10; i++) {
            document.write("Your input: " + input + "<br><br>");
        }
</script>
</body>

Output:

My javascript using \n:
<body>
    <h1>Foo App</h1>

<script charset="utf-8">
  var input = null;

        input = prompt("Enter something: ");

        for (var i = 0; i < 10; i++) {
            document.write("Your input: " + input + "\n\n");
        }
</script>
</body>

Output:

A:

document.write() writes a block of HTML. And in HTML, <br> creates a new line. Therefore, if you want to create a new line when using document.write(), you will have to use <BR>

