开发者

why does javascript have a set of built in objects? [closed]

开发者 https://www.devze.com 2023-01-15 07:29 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago. 开发者_如何转开发

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号