Why won't this function work?


var name = prompt(“Tell me your name”)
function sayHello(name){
console.log(“Hello” + name);


functions only execute when called. You never call the function


How do I call it? If I put console.log(sayHello) underneath it still doesn’t print the message


Now that you know what you are looking for, you can consult documentation:



So now i’ve got this:
var sayHello = function(){
var name = prompt(“Tell me your mf name you piece of crap!!!”);
console.log("Hello " + name + “!”);

It works fine on this other website i’m using, but if I type it in on the Codecademy type editor, it will say that “prompt is not defined at sayHello” which I don’t understand because prompt is a premade tool that the website already understands right?


sounds like a glitch in the website, maybe refresh/reset the exercise? Or try a different browser altogether.


Okay, thanks/ I looked it up and it seems like a lot of people started having that problem after the website updated.