04-Javascript
JavaScript
- JavaScript is the world’s most popular programming language.
- JavaScript was initially created to “make web pages alive”.
- JavaScript is a lightweight, interpreted programming language.
- JavaScript is dynamically-typed language, i.e. it performs type checking at runtime. This means that scripts written in dynamically-typed languages can compile even if they contain errors that will prevent the script from running properly (if at all).
- It is a full-fledged programming language that enables dynamic interactivity on websites when applied to an HTML document.
- JavaScript ≠ Java
Linking JavaScript to HTML document:
- Internally
- Externally
Linking JavaScript Internally:
JavaScript can be linked internally using <script>
tag in same HTML document.
<html>
<head>
<title>JavaScript</title>
<script>
<!--
JavaScript Code......!
-->
</script>
</head>
<body>
</body>
</html>
Linking JavaScript Externally:
Scripts can also be placed in external files.
index.html
<html>
<head>
<title>JavaScript</title>
<script src="myScript.js"></script>
</head>
<body>
</body>
</html>
myScript.js
//JavaScript Code......!
alert("Hello World!");