Help me please!


I'm making my own javascript game and I am trying to make it so the user types in a name and it makes a variable with that value. Can anyone help me??? Please.


here is the code so far:
confirm('Are you reay to play?')
var AreYouSure = prompt("Are you sure")
if("yes" === AreYouSure)
alert ("Play on!")
alert ("You do not want to play!?!?!");
var userName = ("Al")
userName = prompt(What is your name?)
confirm('Once apon a time there was a hero named (userName)...')

am I doing anything wrong


You create a variable userName and you store a string in it. you do not need the parenthesis around it.
Now on this line

there are two things to note.
You are overriding the userName variable and also the Window.prompt() method in JavaScript takes in one argument and the its type must be a string but in your code the argument you are passing is not a string.
On this line

I see you wanted to pipe the value of userName in the string you are displaying. Take a look at the example below to get an idea how to do that

var language = "JavaScript";
console.log("I love %s programming",language);//I love JavaScript programming
console.log("I love "+language+" programming");//I love JavaScript programming

//would not recommend in this situation
console.log("I love",language,"programming");//I love JavaScript programming

Hope this helped


Thank you, also how do I insert the variable into a line of text this is what I've tried so far:
confirm("Hi I'm"(userName));


Can you find anything wrong this this code I can't:
confirm("Are you ready to play?")
var AreYouSure = prompt(β€œAre you ready to play?”)
if(AreYouSure === yes)
console.log("Yay time for a race");
console.log("You do not want to play!!!");
console.log("You are at a Olympic race, and you hear someone say ''Ready... Get set...Go!!!!!!.'");
console.log("Suddenly, Billy the Runner stops and says, 'Who wants to race me?'");
var userAnswer = prompt("Do you want to race Billy the Runner?")
if("yes" === userAnswer)
console.log("You and Billy start racing. It's neck and neck! You win by a shoelace!");
console.log("Oh no! Billy shakes his head and says ''Noooo! How did you beat me.");
var feedback = prompt("Rate my game 10 out of 10")
if(feedback > 8)
console.log("Thank you! We should race at the next Olympics!");
console.log("I'll keep practicing coding and racing.");
console.log("Billy ask what your name is");
var userName = ("Default")
var userName = prompt("Your name is...")
console.log("Your name is...");
confirm("~~Four years later~~")
//the next olyimpics