mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-27 19:00:42 -04:00
fix(curriculum): change Guest to null in prompt lecture (#65770)
This commit is contained in:
@@ -44,7 +44,7 @@ btn.addEventListener("click", () => {
|
||||
|
||||
In this example, when the user clicks on the button, the `prompt()` method displays a dialog box with the message `What is your name?` and an input field that initially contains the value `Guest`.
|
||||
|
||||
If the user types their name and presses "OK", the `userName` variable will store the entered value. If the user presses "Cancel," the `userName` variable will be set to `null`. `null` signifies that the user did not provide any input. The output paragraph will then display a greeting message using the provided name or `Guest` if the user canceled.
|
||||
If the user types their name and presses "OK", the `userName` variable will store the entered value. If the user presses "Cancel," the `userName` variable will be set to `null`. `null` signifies that the user did not provide any input. The output paragraph will then display a greeting message using the provided name or `null` if the user canceled. You will learn techniques to avoid displaying `null` when a user cancels the prompt in future lessons.
|
||||
|
||||
Keep in mind that the `prompt()` method will halt the execution of the script until the user interacts with the dialog box.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user