JS Java Scripts
JS Java Scripts
Ahmad Damra
MCT, MCSD, MCPD, MCTs
FB.COM/Mr.AhmadDamra
©2021 Ahmad Damra
Introduction to JavaScript
What is JavaScript?
History
Uses
Adding JavaScript to HTML
JavaScript syntax
JavaScript events
JavaScript classes
The HTML Document Object Model
Variables contain values and use the equal sign to specify their value.
• !
• &&
• ||
Assignment operators
=, +=, -=, *=, /=, %=
Bitwise operators
&, |, ^, >>, <<, >>>
function showConfirm()
{
confirm("Are you sure you want to do that?");
}
A String object is created every time you use a string literal (just like in Java)
Have many of the same methods as in Java
charAt, concat, indexOf, lastIndexOf, match, replace, search, slice, split, substr,
substring, toLowerCase, toUpperCase, valueOf
There are also some HTML specific methods
big, blink, bold, fixed, fontcolor, fontsize, italics, link, small, strike, sub, sup
• “if” statement
• “if … else” statement
• "? :" ternary conditional statement
“for/in” Loops