The Journey of #100DaysOfCode (wassim_taleb)

๐ƒ๐š๐ฒ๐Ÿ”: ๐ฉ๐ซ๐จ๐ฆ๐ฉ๐ญ ๐ฏ๐ฌ. ๐š๐ฅ๐ž๐ซ๐ญ ๐Ÿ๐ฎ๐ง๐œ๐ญ๐ข๐จ๐ง๐ฌ

 ๐ฉ๐ซ๐จ๐ฆ๐ฉ๐ญ 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.

2 Likes