JavaScript: How to rewrite code to use dynamic values instead of hard-coded ones?

82 views Asked by At

I have following JavaScript function as code snippet:

window.registerWebAuthn = function () {
            const publicKeyCredentialCreationOptions = {
                challenge: new Uint8Array(26),
                 rp: {
                    name: "Example",
                    id  : "localhost"
            },
                user: {
                    id: new Uint8Array(26),
                    name: "[email protected]",
                    displayName: "Foo Bar"
                }
            };

The string values for the following parameters are hard-coded:

  • id
  • name
  • displayName

I want to rewrite this code to use dynamic values.

Can you tell me how I can do that?

0

There are 0 answers