alert and prompt in javascript 1

alert and prompt in javascript

let name = prompt("What's your name?")

alert("Hello " + name);

Here is what the above code is Doing:
1. We’re creating a variable called name and setting it equal to the result of the prompt function.
2. We’re using the alert function to display a message to the user.
3. We’re using the + operator to concatenate the string “Hello ” with the value of the name variable.

Similar Posts