Lesson 6 Javascript - Introduction
Lesson 6 Javascript - Introduction
6.1 Introduction
JavaScript is one of the 3 languages all web developers must learn:
1. HTML to define the content of web pages
2. CSS to specify the layout of web pages
3. JavaScript to program the behavior of web pages
You don't have to get or download JavaScript.
JavaScript is already running in your browser on your computer, on your tablet, and on your smart-
phone.
JavaScript is free to use for everyone.
JavaScript is a client-side, object-based scripting language that is used to handle and validate
client-side data. JavaScript is also used for making the user interface of the web pages more
dynamic making it responsive to events like the movement of the mouse, mouse click on a
certain HTML element, button clicks, etc, using which we can improve the user experience.
6.2 Embedding JavaScript in HTML
HTML provides 3 places to put the JavaScript code:
You can create a variable with the var keyword, whereas the assignment operator (=) is used to assign
value to a variable, like this: var varName = value;
NB: it’s not recommended to declare a variable without var or let keyword .it can accidentally overwrite
an existing global variable. If define without var keyword becomes global variables.
The const keyword works exactly the same as let, except that variables declared using const keyword
cannot be reassigned later in the code.