on 1 comment

JavaScript Program to Display Hello World

In JavaScript, you can display any string using alert box. JavaScript alert is a method of window object. But we can also it explicitly without reference to window object. There are many other ways in JavaScript to display string like console.log method.

JavaScript Program to Display Hello World using Alert Box

<!doctype html>
<html>
  <head>
      <meta charset="utf-8">
      <title>Hello World</title>
  </head>
  <body>
      <button onclick="print()">Click Me...</button>
  </body>
  <script>
      function print(){
          alert("Hello World...");
      }
  </script>
</html>

Output:



When you click on this button, a pop up box occurs that displaying "Hello World...".

JavaScript Program to Display Hello World using console.log

console.log method is used to print string on console window. If you use this method nothing will display on the screen, but it will display on console window.

<!doctype html>
<html>
  <head>
      <meta charset="utf-8">
      <title>Hello World</title>
  </head>
  <body>
      <button onclick="print()">Click Me...</button>
  </body>
  <script>
      function disp(){
          console.log("Hello World...");
      }
  </script>
</html>

Output:







1 comment:

  1. Online movies
    Watch movies online
    Best online movies
    Movies online


    Looking for a streaming free movie online to watch? A Netflix search? Use our online streaming movie

    and TV search engine to find the best movie and TV shows tostreamonline. Use the Netflix catalog to

    find the best movie SpeedyTV is an online streaming movie search engine with filters to find the best

    movies for you. Use our website to watch movies online through services such as through the Netflix

    catalog. Its easy ... Sort and filter streaming movies based on release year, IMDB and Rotten Tomatoes

    ratings, and Age/MPAA ratings. Then click on the movie to get more details and a direct link to vie w the

    movie online.

    ReplyDelete