The Three Essentials of Front-End Development

  • HTML describes the content of a web page
  • CSS describes the style of a web page
  • JavaScript controls the behavior of the page and browser, responds to actions, and talks to the server

What Is JS

  • An interpreted programming language (scripting)
  • Runtime: it runs in a browser engine, and engines can also run outside the browser

JS History

  • Created in 10 days in 1995
  • Renamed JavaScript to promote it through a partnership with Sun, though it has nothing to do with Java
  • DOM specification released in 1998
  • Ajax arrived in 2005, ushering in the Web 2.0 era
  • ECMAScript 5.1 released in 2011

JS in the Browser

  1. ECMAScript: the core standard for the JS language
  2. DOM (Document Object Model): a W3C standard that provides APIs for working with document objects
  3. BOM (Browser Object Model): APIs for working with browser objects

Including JS

Inline code, wrapped in usually placed in

1
2
3
4
5
6
7
8
9
10
11
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>js</title>
</head>
<body>
<script type="text/javascript">
document.write("hello world");
</script>
</body>
</html>

External files

1
2
3
4
5
6
7
8
9
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>js</title>
</head>
<body>
<script type="text/javascript" src = "demo.js"></script>
</body>
</html>