I am new to JS. I heard that functions can be manipulated like values in this language. So I tried writing a code that asks the user for a function, then call this function, which should be alright. But it doesn't work, the code is :
<SCRIPT language=javascript>
var input;
(function PromptMessage() {
input = prompt("type the function you want called")
})()
input();
</SCRIPT>
And in the prompt box I type function () {alert("I am an alert box!");}
But it doesn't work, I don't see the alert. Am I doing something wrong or it is that the only callable functions are defined in the source code ?