task-print2

by Dong Shelton

HTML

<div id="content"></div>

CSS

#content {
  position: relative;
  white-space: pre-line;
}

JavaScript

(function() {
	var Content = {};
	Content.println = (function(argument) {
		var dom = document.getElementById("content");
		return function(text) {
			var textNode = document.createTextNode(text + "\n");
			dom.appendChild(textNode);
		}
	})();
	Content.println("script start");
	setTimeout(function () {
		Content.println("setTimeout");
	}, 0);
  for(var i = 0; i < 999999999; i ++){
    //do something
  }
	Content.println("script end");
})();