why doesn't javascript print new row with \n?

why doesn't t
why doesn't it work
why doesn't my
why doesn't he want me
why doesn't voldemort have a nose
why doesn't alice talk at school
it doesn't matter carr
it doesn't matter nicholas carr summary

I have a problem with JS, whenever I write "\n" while in script tag, it doesn't print new row.I am new to Javascript so can someone explain to me what is the problem?

Here is the code from my excercise:

<html>
<head>
  <meta charset="utf-8">
  <script>
    var output;
    var number = window.prompt("Enter mobile no:  \n");
    if( number>10000000 && number<99999999){
     var ps = parseInt(number/1000000);
     var vs = parseInt((number/1000)%1000);
     var ts = number%1000;
     output = "0" + ps + "/" + vs + "-" + ts +" ";
      document.write("Mobile no. is : " + output + " "  + "\n");


   if( ps == 70 || ps == 71 || ps == 72 ){
      document.write("Mobile no. is T-Mobile " + "\n");
   }
   if( ps == 75 || ps == 76){
      document.write("Mobile no. is One " + "\n");
   }
   if( ps == 77 || ps == 78){
      document.write("Mobile no. is Vip " + "\n");
   }

    }
  </script>

</head>

<body>

//not important

</body>
</html>

You're outputting to the browser, so HTML is relevant, not plain text. Just replace the "\n" with "<br>".

Why doesn't the Leaning Tower of Pisa fall over?, If playback doesn't begin shortly, try restarting your device. Your browser does not currently Duration: 5:06 Posted: Dec 3, 2019 Why Day-Trading Doesn't Work And another reason why bonds are not going to be good, because if you have a bond that's paying 1% or 2%, but inflation is 3%, 4%, 5%, you're losing purchasing

You are writing HTML to the page. It does not recognize new lines. You need to use the "<br>" tag.

Why Doesn't Alicia Talk?: Understanding Autism , Amazon.com: Why Doesn't Alicia Talk?: Understanding Autism (9781504951883)​: Hudak, Debbi, Finney, Caitlin: Books. Trump Explains Why He Doesn't Wear a Mask Says he's 'all for' them, but isn't convinced the US needs a national mask mandate By

If you are writing in a .html file use <br> tag like this:

document.write("<br>");

Otherwise, you can use "\n".

Why does "Why doesn't it work?" become "Why does it not work , You form questions in English by inverting the subject and the verb. For the OP's two sentences, the verbs you use in this inversion are does  My Crush Doesn’t Like Me. Here are the most likely reasons why: 1. You’re too needy. This is a timeless turnoff. Just as confidence is a turn-on, a lack of confidence that causes you to act needy will drive him away.

IT Doesn't Matter, As information technology's power and ubiquity have grown, its strategic importance has diminished. The way you approach IT investment and management will  Why doesn’t He show Himself to each generation of humanity so that everyone on Earth can see and hear Him and know beyond a shadow of a doubt that He is real? After all, according to the Bible, the Lord appeared “to Abraham, to Isaac, and to Jacob, as God Almighty” (Exodus 6:3), and He “spoke to Moses face to face, as a man speaks to

Why Doesn't This HR Department Get Any Respect?, And within a year, two of the five remaining senior managers had resigned as well. “It doesn't matter why those two left,” Robinson told Rose between bites of  Why doesn’t God respond when I cry out, “God, please help me!”? Question: "Why doesn’t God respond when I cry out, ‘God, please help me!’?" Answer: Many have felt abandoned by God in their times of greatest need, asking God for help but not receiving what was asked for.

Why Trump doesn't want to wear a mask - CNN, It's no surprise that President Donald Trump says he won't follow CDC recommendations to wear a mask to stop the spread of coronavirus,  Customer Services means it adds substantial costs to the operations of Facebook. Most of their subscribers get free subscriptions to FB. Gone are the days when companies like Microsoft or Facebook or Google provide humans as customer service provi

Comments
  • Possible duplicate of How do I create a new line in Javascript?
  • Put your code in the question, not another site.
  • document.write("<br>"); is a new html line