Code has been added to clipboard!

Global Objects

Reading time 3 min
Published Aug 9, 2017
Updated Oct 10, 2019

JavaScript Global Objects: Main Tips

  • JavaScript offers a range of global functions and properties you can use with all of the built-in JavaScript objects.
  • These JavaScript global objects are always available for use, making them very universal and efficient.

Introduction to Global Objects

Let's begin with a short introduction to the concept of JavaScript global objects. They can also be referred to as built-in objects that are used to extend the capabilities of the JavaScript language. Even if you're just taking your first steps in coding, you will be able to exploit any global object JavaScript has to offer.

There are multiple categories of JavaScript global objects. Probably one of the easiest ones to grasp is the global value properties that have neither properties nor functions.

JavaScript global objects also include different types of errors that developers receive when their code goes off the track. For instance, SyntaxError will indicate that a problem related to syntax has occurred in your code.

There is a wide variety of JavaScript global functions that you can apply in your code. JavaScript math functions are also built-in, meaning that you can easily manipulate numerical values and complete advanced mathematical calculations.

Methods that are related to string manipulation are also built-in, together with the RegEx (regular expression). With their help, you can manage strings and their content easily.

What Global Properties Are

We have already mentioned that one of the categories of JavaScript global objects is called global properties. They have no properties and no methods. The table below lists a couple of global properties that you should remember:

Property Description
Infinity A numeric value representing a positive/negative infinity.
NaN Not-a-Number. Means that the returned value is not a valid number.
undefined Means that a certain variable has no value assigned.

Definition of Global Functions

Another significant category consists of JavaScript built in functions. JavaScript global functions can perform many actions, starting from string manipulation and ending with conversion of values to numbers.

Take a look at the table below. In it, we have explained a variety of JavaScript built in functions you can apply:

Function Description
decodeURI() Decode URI.
decodeURIComponent() Decode URI component.
encodeURI() Encode URI.
encodeURIComponent() Encode URI component.
escape() DEPRECATED IN VERSION 1.5. encodeURI() and encodeURIComponent() are used instead.
eval() Evaluate string and execute as if it was script code.
isFinite() Determine whether a value is finite, legal number.
isNaN() Determine whether a value is illegal number.
Number() Convert object's value to a number.
parseFloat() Parse string and return floating point number.
parseInt() Parse string and return integer.
String() Convert object's value to string.
unescape() DEPRECATED IN VERSION 1.5. decodeURI() and decodeURIComponent() are used instead.
What Is JavaScript Used For?
Tutorial
Introduction
Output
Syntax
Comment
Commands
Operators
Comparison and Logical Operators
Data Types
Math.random()
Type Conversion
Function Definitions
Events
Objects
Object Properties
Prototype
Array
Sorting Arrays
Strings
Numbers
Number Format
Math Object
Onclick Event
Date
Date Formats
Scope
Regular Expressions
Reserved Words
Common Mistakes
Performance
Forms
Form Validation
Window: The Browser Object Model
Popup Boxes
Cookies
JSON
AJAX Introduction
AJAX Form
Automatic File Download
Functions
Array Methods
String Methods
Date Methods
Timing Events
Cheat Sheet
JavaScript in HTML
HTML DOM Methods
HTML DOM Changing HTML
HTML DOM Animation
HTML DOM EventListener
HTML DOM Navigation
HTML DOM NodeList
HTML DOM Element Nodes
Array Functions
Boolean
Calling a Function
Date Functions
Global Objects
Input Text
Operator
Statements
String Functions
Math
Math.random
Number
RegEx
alert
array.filter
array.length
array.map
array.reduce
array.push
array.sort
break and continue
className
confirm
decodeURIComponent
for
forEach
if
indexOf
innerHTML
location.reload
number.toString
onclick
onload
parseInt
prompt
replace
setAttribute
setInterval
setTimeout
slice
splice
string.includes
string.indexOf
string.split
style.display
submit
substr
substring
switch
test
throw, try and catch
toLowerCase
toUpperCase
use strict
while
window.history
window.location
window.navigator
window.screen