fix(curriculum): change Guest to null in prompt lecture (#65770)

This commit is contained in:
Aditya Singh
2026-02-09 18:54:03 +05:30
committed by GitHub
parent d6db37d423
commit cf47ffaa0d

View File

@@ -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.