JS Introduction
1. Intro
- WHAT: JavaScript is the programming language of HTML and the Web.
- HOW: JavaScript is easy to learn.
- WHY: JavaScript is one of the 3 languages all web developers must learn:
- HTML to define the content of web pages
- CSS to specify the layout of web pages
- JavaScript to program the behavior of web pages
Java vs. JavaScript
- They are completely different languages, both in concept and design.
- JavaScript was invented by Brendan Eich in 1995, and became an ECMA standard in 1997. ECMA-262 is the official name (a.k.a. ECMAScript).
2. A Simple Example
<!DOCTYPE html>
<html>
<body>
<h1>My First JavaScript</h1>
<button type="button" onclick="document.getElementById('demo').innerHTML = new Date() ">
Click me to display Date and Time.
</button>
<p id="demo"></p>
</body>
</html>
<script>
alert('Welcome!');
</script>