document.write(" I am \n learning js"); I wrote this code but line is not breaking why.
Try the <br> tag instead of '\n'.
Adnan Ur Rehman document.write(someContent) writes someContent to the document as html markup. That means someContent is treated as html code. So, to put a line break in a html document we need <br/> element.