Function getUrlParam

  • Returns the value of the specified query parameter in the input URL.

    Usage:

    const p1 = getUrlParam('http://example.com/?t1=1&t2=2&t3=3&t4=4', 't3');
    const p2 = getUrlParam('http://example.com/?t1=1&t2=2&t3=3&t4=4', 't4');
    console.log(p1, p2);

    Output:

    3 4
    

    Parameters

    • url: string

      The URL string.

    • param: string

      The query parameter to retrieve the value for.

    Returns string | string[]

    The value of the specified query parameter, or an empty string if the parameter is not found.