function Sphere(radius) { this.radius = radius; this.pi = 3.14; this.volume = function() { return Math.pow(this.pi, 3) * 3/4 * this.radius; } } var startTime = Date.now(); var balls = []; for (var x = 0; x < 1000000; x++) { balls[x] = new Sphere(10); } var elapsedTime = Date.now() - startTime; document.body.innerHTML += "<p>Time to create 1 million balls: " + elapsedTime + "ms</p>";