Overview of JavaScript
WMSU
JASEL MAE T. JUNASA
WESTERN MINDANAO STATE UNIVERSITY
1
Wha is JavaScript?
JavaScript is a programming language for
websites. It can manipulate both HTML&CSS
It can perform logical checks, calculation,
modify existing HTML&CSS and more.
It is the most popular programming language
as of the moment.
2
<script> Tag
The <script> tag allows us to write
JavaScript code inside of our HTML File.
3
console.log()
This code display a log in the developer
console of browser.
4
Devloper tools
Is the tool in debugging JavaScript codes
and also viewing our output using
console.log()
5
External JavaScript
script.js
Console.log(“Hello Word”);
Script.js
Index.html
Console.log(“Hello Word”); <html>
<script src=“script.js></script>
</html>
6
Variables
Are temporary containers that can hold
different types of data such as the text,
numbers, collections, object and etc.
Variables can be named for easy/write
access by the programmer it is called an
identifier.
7
Identifier
Variables name that has been set by the programmer.
Identifier must UNIQUE
Identifier are CASE SENSITIVE
RESERVE KEYWORDS are NOT Allowed as Identifiers
Identifiers MUST start with LETTER, $ or _
Identifier CANNOT contain SPECIAL CHARACTERS
8
4 ways of Declaring Variables
Automatically
using var
using let
using const
9
Automatically
Automatically variables automatically declare
themselves.
X= 5;
Y = 12.5;
z = “Hello Word”;
10
Using let
Uses the keyword, it cannot be redeclared.
It is preferred to be used by default when
declaring variables.
let x = 5;
let y = 12.5;
let z = “hello word”;
11
Using const
Uses the const keywords, it cannot be
redeclared these variables. Cannot be
reassigned/changed.
const x =5;
const y=12.5;
const z=“hello word”;
12
Using var
Uses the var keyword, it can be redeclared
and should only be used when to support
older browsers.
var x =10;
var y= 10.5;
var z=“hello word”;
13
Data types
The type of data that the variable is currently holding.
• String
• Number
• Booleans
• Underfined
• Null
• Object
• Bigint
• Symbols
14
//String
Let name = “Hello Word”;
//Number
Let number = 5;
//Boolean
Let isCoding = false;
//Undefined
Let nickname;
//Null
15
Let lastName = Null;
16