JavaScript built-in objects
specialized objects (the "jargon sets")
Last updated
specialized objects (the "jargon sets")
Last updated
Sometimes we need specialized objects to help express what we want to do - a specialized "vocabulary" within the programming language (a jargon!) ...
... behold, some examples of built-in objects:
JavaScript comes with a built-in Date
object which tells us the current date but in its standard format
There exist many ways to format this date via other functions (as well as writing our own) which we can read in the !
JavaScript comes with a built-in Math
object that allows us to do essential mathematical functions without having to rewrite them, e.g.:
We can call other functions of Math
such as:
Math.sin(x)
to get "the sine of x"
Math.sqrt(x)
to get "the square root of x"
Math.pow(x, y)
to get "x to the power of y"
We can also use its properties such as:
Math.PI
to get an approximation of pi (3.14159
)
Math.E
to get an approximation of Euler's constant (2.718
)
See and as well as in the Mozilla Developer Docs