Built-in objects

To add flexibility in language, JavaScript supports a number of built-in objects. The most commonly used objects are:

  • Global
  • Date
  • Math
  • RegExp (Regular Expression)
  • Array

Implementations of these built-in objects are complex and different.

Global objects

Global objects are objects defined outside the function. Every function can access these variables because their scope is global for all.

When you do not declare a variable and assign a value to it, then it will automatically become global.

Description

When your code starts execution, functions and constants immediately become available. A global variable does not initialize with the new keyword. Basically, global objects are used to share same data to add properties. You can store methods ...

Get Web Developer's Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.