+ 1
Problem with Javascript
Hi In this little code, i need to recover the value of prompt in a variable. prompt("put a calcule"); let a = prompt() Please help
4 odpowiedzi
+ 6
Hi"-" ,
You can directly use prompt() to a variable as prompt displays a dialog box to input value from user with optional message .
👇🏻
For Example :
let a = prompt("put a calcule ");
alert(a);
you can alert or print the value of variable on the screen
+ 6
Hi"-" To retrieve the value from the prompt dialog and store it in a variable, you need to assign the result of prompt() to a variable
Example:
let a = prompt("Put a calculation:");
console.log(a); // This will display the entered value in the console.
+ 3
Ok thanks
+ 1
Hi"-" You're welcome! 😊