Introducing JavaScript (Sample Code)

What can you do with JavaScript? Here are just a things you can do...

  1. Use JavaScript to respond to events (event handling).

  2. Use JavaScript to validate user input.

    Enter a number:   Please enter a NUMBER
  3. Use JavaScript for animation.

  4. Use JavaScript to fetch data from a web server.
    (Note: This code is not actually fetching data from a server, it's just a simulation.)

  5. Use JavaScript to control the elements in an HTML page.