jsguides

Reference

Global Functions

Top-level functions available in every JavaScript environment.

  1. decodeURI()

    decodeURI() reverses percent-encoding in URIs while keeping structural characters intact. Pairs with encodeURI() for safe round-trip URL encoding.

  2. decodeURIComponent()

    decodeURIComponent() reverses percent-encoding on URI components, decoding reserved characters like /, ?, and & that decodeURI() leaves untouched.

  3. encodeURI()

    Use encodeURI() to encode a complete URI by escaping special characters while preserving structural characters such as slashes, question marks, and ampersands.

  4. encodeURIComponent()

    encodeURIComponent() percent-encodes strings for safe use in query strings and path segments, escaping all chars except letters, digits, and - _ . ! ~ * ( ).

  5. eval()

    The eval() function executes JavaScript code from strings — covers syntax, security risks, performance costs, and safer alternatives.

  6. isNaN()

    Determine if a value is NaN (Not-a-Number). Differs from Number.isNaN() by coercing its argument to a number first.

  7. parseFloat()

    parseFloat() reads a string and returns a floating-point number, stopping at the first non-numeric character. Use it for CSS values and user input.

  8. parseInt()

    parseInt() parses a string in a specified radix and returns an integer, handling whitespace, non-numeric suffixes, and number bases from binary to hexadecimal.

  9. queueMicrotask()

    queueMicrotask() schedules a function to run as a microtask, after the current task finishes and before the event loop yields control.

  10. structuredClone()

    structuredClone() creates a deep copy of any structured-cloneable JavaScript value. Handles Maps, Sets, Dates, RegExps, typed arrays, and circular references.