window.onload = function() {

	var hello = document.getElementById("hello");
	
	function es5Date() {
	  var time = Date.now();
	}
	
	function newDate() {
	  var time = new Date().getTime();
	}
	
	function timeIt(title, fn, times) {
	  times = times || 1;
	  title = title || "Starting timer...";
	  log(title + " " + times + " times");
	  var now = Date.now();
	  for (i = 0; i < times; i++) {
	    fn.call();
	  }
	  var then = Date.now();
	  log((then - now) / 1000);
	};
	
	log = function(string) {
	  if (window.console) console.log(string);
	  hello.innerHTML = hello.innerHTML + "
" + string + "
"; } timeIt("Testing Date.now()", es5Date, 10000000); timeIt("Testing new Date().getTime()", newDate, 10000000); }