Javascript's document.write prevents following code execution
<p>I understand <code>document.write</code> prevents the executing of following javascript.</p>

<p>For example the <code>document.write</code> will prevent the execution of the following javascript until the <code>document.write</code> block has completely executed.</p>

<pre><code>&lt;!doctype html&gt;
&lt;script&gt;
document.write('&lt;script&gt;alert(1)&lt;'+'/script&gt;');
alert('2');  
&lt;/script&gt;
</code></pre>

<p><a href="http://jsbin.com/alefob" rel="nofollow">http://jsbin.com/alefob</a></p>

<p>You can take this even further and require for javascript to be loaded remotely before executing the following script.</p>

<pre><code>&lt;!doctype html&gt;
&lt;script&gt;
document.write('&lt;script src="remote_script.js"&gt;&lt;'+'/script&gt;');
alert(remote_script_variable);  
&lt;/script&gt;
</code></pre>

<p>Obviously I could do a callback, but that's not what I'm looking for.</p>

<h2>Question</h2>

<p>Basically do any other functions have this unique functionality of preventing scripts from loading until completion (others functions that I might want to avoid)?</p>

<p>Assuming that no other functions have this unique functionality.  Can <code>document.write</code> ever be used after page load without overwriting the pages content?  </p>

<h2>Already Understood</h2>

<p>I know you can do the following along with using <code>yennop.js</code></p>

<pre><code>var script = document.createElement('script');
var currentScript = document.getElementsByTagName('script')[0];
currentScript.parentNode.insertBefore(script,currentScript);
script.src = '//some url';
</code></pre>
