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.

Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid certificates of completion
Coursera
Pros
  • Professional service
  • Flexible timetables
  • A variety of features to choose from
Main Features
  • Professional certificates of completion
  • University-level courses
  • Multiple Online degree programs
Datacamp
Pros
  • Great user experience
  • Offers quality content
  • Very transparent with their pricing
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable

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.

Latest Udacity Coupon Found:

Verified STAFF PICK

75% OFF COURSES

Udacity Black Friday Offer

The best time to save on Udacity courses is now - follow this coupon to access a 75% Udacity Black Friday discount & enjoy learning at a very low cost!

Expiration date: 09/03/2021
3176 People Used
Only 97 Left
Rating
5.0