๐๐๐ฒ๐: ๐ฉ๐ซ๐จ๐ฆ๐ฉ๐ญ ๐ฏ๐ฌ. ๐๐ฅ๐๐ซ๐ญ ๐๐ฎ๐ง๐๐ญ๐ข๐จ๐ง๐ฌ
๐ฉ๐ซ๐จ๐ฆ๐ฉ๐ญ and ๐๐ฅ๐๐ซ๐ญ are built-in functions used to interact with the user, but they serve different purposes:
โ alert purpose is displaying a message to the user, and shows a dialog with a specified message and an OK button. The user cannot interact with the rest of the page until the OK button is clicked, as well as itโs useful for showing information or warnings to the user.
โ prompt purpose is to ask the user to input a value. It shows a dialog with a specified message, a text input field, and OK and Cancel buttons. The function returns the input value if the user clicks OK or null if the user clicks Cancel. Also, it is useful for collecting simple user input.
