How do I pop up an alert in Javascript?

前端 未结 9 865
半阙折子戏
半阙折子戏 2021-01-19 16:03

How do I pop up an alert in Javascript?

I tried alert\"HELLO\" but that didn\'t work.

Can someone tell me the correct syntax?

Oh by the

9条回答
  •  [愿得一人]
    2021-01-19 16:53

    There are a few ways.

    1. Use your web browser, type this code in address bar.

      javascript:alert("Hello World!")

    2. Open web developer in your web browser, go to console and type:

      alert("Hello World!")

    3. Type the code in .html or .js code as shown in other answers above.

提交回复
热议问题