javascript - Prompt inside a function -
so new coding. wondering whether possible have prompt inside function. example of code below:
var username = function(name) { var n = prompt("whats name?"); console.log(n) };
i want print out name going inputted. thanks
yes, this:
var username = function(){ return prompt("whats name?"); }; console.log(username());
Comments
Post a Comment