+ 2
Name Input
How do I make an Alert with Input, followed by an Alert that uses the Input in Web. For example: Whats your name? <Input> OK, <Input>, lets play! Can somebody help me (I am a beginner)
6 odpowiedzi
+ 5
When you don't need the name elsewhere:
JS:
alert("OK, " + prompt("Whats your name?") + ", lets play!");
ES6:
alert(`OK, ${prompt("Whats your name?"}, lets play!`);
If you DO need it later:
JS:
var name = prompt("Whats your name?");
alert("OK, " + name + ", lets play!");
ES6:
const name = prompt("Whats your name?");
alert(`OK, ${name}, lets play!`);
+ 1
Thx!
+ 1
Oh thank you!
+ 1
And how do I get this into a specific Line?
0
So when I put this into my code, its in the end, but how do I get it for example in the 3rd line?