why does javascript have a set of built in objects? [closed]
any particular reason?
The same reason any language has a standard library. It doesn't have many, and the ones it does have are quite useful.
The only object types ECMAScript has are:
- Object
- Function
- Array
- String
- Boolean
- Number
- Date
- RegExp
along with the standard error objects. Omitting even one of the above would significantly decrease the language's ease of use.
Note that the W3C APIs many people conflate JavaScript with are not built-in to the language.
Essentially so that you don't have to write them.
Technically, some of the built in functions wrap functionality that you really couldn't do in JavaScript itself (i.e. build the dom--direct "Browser" interface).
精彩评论