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()); 

http://jsfiddle.net/mskf3mu1/


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -