# Why does JavaScript have the Math object?

In many languages, to find cosine, you use `cos(x)`

. But in JavaScript, you must use `Math.cos(x)`

. Why doesn't JavaScript spare us the 5 characters in `Math.`

, both making it easier to type and easier to read?

I have tried to Google this multiple times, and found no answers. Is there any practical reason for this that I have not yet found?

So far, there are three reasons I can think of:

The creators of JavaScript want to ensure that the math functions do not coincide with other functions users create (Like a function called 'cos()` that calculates, say, cosecant)

The creators of JavaScript thought that

`Math`

would make the code more readableThe creators of JavaScript perhaps didn't want any functions that have

`window`

as a parent (Though`alert`

and`prompt`

make this unlikely)

I'm honestly surprised nobody's asked this before

If you wish to use certain Math functions often and don't like repeating the `Math.`

part, feel free to extract the standalone properties first. `const { cos } = Math;`

The global scope is already overloaded enough IMO