btoa() Method
This method encodes a string in base-64 and uses the “A-Z”, “a-z”, “0-9”, “+”, “/” and “=” characters to encode the provided string.
Syntax:
window.btoa( String )
Parameter (String): This parameter is required. It specifies the string to be encoded.
JavaScript | Encode/Decode a string to Base64
To encode or decode strings in JavaScript, we can use the built-in functions provided by the language. These functions help in encoding special characters in a URL or decoding encoded strings back to their original form.