Skip to content Skip to sidebar Skip to footer

Prompt Return As Undefined In A Function. (scope Issue)

I believe it's a scope issue because I tried setting my function userPrmpt inside firstPartCook and it works. I set it outside, and it doesn't. So it's reading, but not keeping wha

Solution 1:

You have to return the value from the prompt, otherwise the function will just return undefined, which is the default return value of any function that has no other value returned from it

function userPrmpt(userResponse){
    return prompt(userResponse);
}

Post a Comment for "Prompt Return As Undefined In A Function. (scope Issue)"