Math
is actually the name of a property of the implicit global
object in ECMAScript, which is a plain-old Javascript object, of type Math
(defined by giving it properties to this single instance, similar to how JSON works). This is documented here in the specification: http://www.ecma-international.org/ecma-262/5.1/#sec-15.8
The Math
object can be thought of like this:
// within the "global" context:
var Math = {
PI: 3.14,
sin: function(x) { ... },
cos: function(x) { ... }
};
Note that no constructor function is defined (nor is Call
defined either), so the expression new Math()
is meaningless and undefined. If it was, then it would look like this:
function Math() {
this.PI = 3.14;
this.sin = function(x) { ... };
this.cos = function(x) { ... };
};
var Math = new Math();