1- HTML only
2- HTML + CSS
3- HTML + CSS + JavaScript
Creating a Basic JavaScript
Code below is a basic JavaScript
Linking to a javascript file from an HTML page in this html tag
*
The best palce to put scripts in their own files is the end of the body
A script is a series of instructions that a computer can follow one-by-one. Each individual instruction or step is known as a statement.
Statements should end with a semicolon.
writting comments to explain what your code does.They help make your code easier to read and understand. This can help you and others who read your code.
Tow ways to write comment
1- // for single line
2- // for multi line
A script will have to temporarily store the bits of information it needs to do its job. It can store this data in variables.
A variable is a good name for this concept because the data stored in a variable can change (or vary) each time a script runs
The variable decleration is as this
var x;
The variable Assigning is as this x=3;
-JavaScript distinguishes between numbers,strings, and true or false values known as Booleans.
3 is a number
‘Ahmed’ is a strings
Boolean is a true or false
A variable name in JavaScript
1- must be started with a letter.
2- can contain letters,numbers, dollar sign ($), or an underscore (_). Note that you must not use a dash(-) or a period (.) in a variable name.
3- should not be keyWord such as if
4-is the case sensetive: so score and Score would be different variable names, but it is bad practice to create two variables that have the same name using different cases.