Introduction to JavaScript

JavaScript is a language that runs in your web browser. It is often used to do things with HTML elements on the page, and can help interact with the user.

Here is an example that shows an alert message. The JavaScript code is between the <script> tags:

<!DOCTYPE html>
<html>
<head>
  <title>My Page</title>
</head>
<body>

<script>
alert("Hello!");
</script>

</body>
</html>

This:

alert("Hello!");

calls the alert function. For now, just think of it as an instruction you give to the web page. It shows an alert:

a web page with an alert dialog showing

Next: Variables in JavaScript

Comments

Leave a comment

What color are brown eyes? (spam prevention)
Submit
Code under MIT License unless otherwise indicated.
© 2020, Downranked, LLC.