JavaScript Global Functions Index

Beginner
4 min read
Updated: Nov 2026
11 function guides
Function index

About This Index

This page is the JavaScript Global Functions index. JavaScript has 11 global functions. Each row below links to a full guide with syntax, examples you can run, and FAQs.

Learn what global functions are on /js/global. Use this page when you need a specific function such as parseInt().

Call them by name.

Global functions need no object in front and no import: write parseInt("42", 10), not Number.parseInt(...) or window.parseInt(...). They work in the browser and in Node.js.

How to Call a Global Function

Call a global function by its name:

JavaScript
console.log(parseInt("42px", 10));              // 42      read a whole number
console.log(parseFloat("3.14abc"));             // 3.14    read a decimal number
console.log(isNaN("hello"));                    // true    is it NaN after converting?
console.log(isFinite(10 / 3));                  // true    a normal number

const url = "https://example.com/search?q=" + encodeURIComponent("a & b");
console.log(url);                               // ...?q=a%20%26%20b
console.log(decodeURIComponent("a%20%26%20b")); // a & b

console.log(eval("2 + 3 * 4"));                 // 14      run code from text (risky)

JavaScript Global Functions Table

All global function guides in this JavaScript tutorial series (11 tutorials), grouped by what they do.

Turn text into numbers

2 functions

Read a number from the start of a string. Both functions stop at the first character that does not fit.

FunctionDescriptionTutorial
parseFloat()Read a number with a decimal part from the start of a string.Open
parseInt()Read a whole number from the start of a string, in any base from 2 to 36.Open

Check a number

2 functions

Test a value before you use it in a calculation. Both convert the value to a number first.

FunctionDescriptionTutorial
isFinite()Return true for a normal number, and false for NaN, Infinity and -Infinity.Open
isNaN()Return true when the value is NaN after it is converted to a number.Open

Encode and decode URLs

4 functions

Make text safe to put in a web address, and turn it back. Use the Component versions for single values.

FunctionDescriptionTutorial
decodeURI()Decode a whole URL and keep the codes of reserved characters like / ? & =.Open
decodeURIComponent()Decode one value, such as a query parameter, including reserved characters.Open
encodeURI()Encode a whole URL and keep its structure characters.Open
encodeURIComponent()Encode one value so it is safe inside a URL.Open

Run code from text

1 function

Run JavaScript that is written as a string. Powerful, but risky.

FunctionDescriptionTutorial
eval()Run JavaScript code written as text and return the result. Avoid it on untrusted text.Open

Old and deprecated

2 functions

These still work, but you should use the URL functions above in new code.

FunctionDescriptionTutorial
escape()Deprecated. Encode text as %XX and %uXXXX codes.Open
unescape()Deprecated. Turn %XX and %uXXXX codes back into text.Open

Frequently Asked Questions

They are functions you call by name from anywhere, with no object and no import. In this series: parseInt(), parseFloat(), isNaN(), isFinite(), encodeURI(), decodeURI(), encodeURIComponent(), decodeURIComponent(), eval(), escape() and unescape().
The Global Functions page explains the idea: what a global function is, how the functions relate to the Number object, and how they behave. This index lists the function guides so you can jump straight to the one you need.
The ones you will meet most are parseInt(), parseFloat(), isNaN() (or Number.isNaN()), encodeURIComponent() and decodeURIComponent(). Use isFinite() to check calculations, and the other URL functions when you work with whole addresses.
escape() and unescape() are deprecated: use encodeURIComponent() and decodeURIComponent() instead. eval() is not deprecated, but it is risky because it runs any code in the text, so avoid it with text you do not control.
Start with parseInt() and parseFloat() to learn how text becomes numbers. Then read isNaN() and isFinite(), and finish with encodeURIComponent() and decodeURIComponent() for working with URLs.

Start with parseInt()

Open the guide for reading whole numbers from text: syntax, examples, and FAQs.

parseInt() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful