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

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -