Group 1 - Overview of JavaScript

Download as pdf or txt
Download as pdf or txt
You are on page 1of 57

Overview

of
JavaScript
Group 1 Members

Vincent Rafael
Onin Binuya
M.Manio

Marc Melgar Lance Aeron


F. Guevarra
What to Learn?

01 03
Introduction to Variables,Data types and
JavaScript Programming operators in JavaScript
03
Writing basic
JavaScript Code
01
Introduction
What is JavaScript?
JavaScript is a lightweight,
cross-platform, dynamically
typed programming language
used for web development for
both client-side and server-side
development
It contains a standard library of
objects, such as array, date, and
math. Additionally, it also has a
core set of language elements
like operators, control structures,
and statements.
This programming language is both
compiled and interpreted, with
newer versions incorporating a
just-in-time (JIT) compiler to
optimize execution and display
results more quickly by generating
bytecode.
JavaScript on the
Client-side and
Server-side
Client-side: JavaScript can supply objects that
control a browser and its Document Object Model
(DOM). Client-side extensions using JavaScript can
allow an application to place elements on an
HTML form and respond to user events such as
mouse clicks, form input, and page navigation.
Several useful libraries for the client side are
AngularJS, ReactJS, and VueJS.
Server-side: JavaScript can supply objects relevant
to running it on a server, where server-side
extensions allow for communication with a
database, continuity of information, and file
manipulations. The most popular framework for
server-side JavaScript is node.js. With node.js,
JavaScript developers can build high-performance
network applications that can handle a large
number of concurrent connections with minimal
overhead.
DID YOU KNOW?

<p> JavaScript is both


an imperative and
declarative type of
language </p>
Imperative language Declarative language
This type of language focuses on how the In this language, the focus is on how the
computation is to be done and controls logical computation is performed, and
the goal is to describe the desired result
the flow of it. The procedural and object-
without dictating the exact process of
oriented approaches are part of it, where achieving it. This is represented by
the focus is on what needs to be done arrow functions, which describe the
after the asynchronous call. expected outcome without specifying
how to obtain it.
2 ways of implementing JavaScript in our HTML file:
Internal JavaScript
We can write JavaScript code in another file
having an extension.js and then link this file
inside the <head> tag of the HTML file in
which we want to add this code.
External JavaScript
We can add JavaScript directly to our HTML file
by writing the code inside the <script> tag. The
<script> tag can either be placed inside the
<head> or the <body> tag according to the
requirement
Syntax

<script>

// JavaScript Code

</script>
Example of Internal JavaScript:
Example of External JavaScript:
Appication of JavaScript
Web
Development Games

Web
Smartwatch
Applications

Server Art
Applications

Mobile Internet
Of
Applications Things
Limitations of JavaScript

Weak error handling and type


Performance checking facilities

Security Complexity
02
Variables, data types and Operators
What is Variable?

Variable are
containers for storing
data.
How Do We Declare Variables?
Var
var x = 5;

let
Variable let x = 5;

Declaration Const
Const price1 = 5;

None
x = 5;
What is Operators?
Operators are equivalent to the
process of adding, subtracting,
multiplying and etc. The following
are the operators that we use in
Javascript
Arithmetic Operators
Assignment Operators
Comparison Operators
EXERCISE

<!DOCTYPE html>
<html>
<body>
<script>
let text1 = “A”;
let text2 =“B”;
let result = text1 < text2;
document.getElementById(“demo”).innerHTML =
“ Is A les than B? ” + result;
</script>
</body>
</html>
Question
Is A less than B? True

I
Logical Operators
Type Operators
Bitwise Operators
Data Types
JavaScript has 8 Datatypes
String Number Bigint Boolean
Let weight = 7.5; let x =
let color = "Yellow"; BigInt("12345678901234567 let x= true;
Let y = 123e5; 8901234567890");

Undefined Null Symbol Object


const RUN = Symbol() const person =
let x; let x = null; person[RUN] = () => 'Person {firstName:"John",
is running' lastName:"Doe"};
The Object Datatype
1. An object
// Object:
const person = {firstName:"John", lastName:"Doe“};
2. An array
// Array object:
const cars = ["Saab", "Volvo", "BMW“];
3. A date
// Date object:
const date = new Date( "2022-03-25“ );
Summary
1. Variable Declaration
• Using var
• Using let
• Using const
• Using nothing
2. Operators
• Arithmetic Operators
• Comparison Operators
• Logical Operators
• Type Operators
• Bitwise Operators
Summary
3. Data types
1. String
2. Number
3. Bigint
4. Boolean
5. Undefined
6. Null
7. Symbol
8. Object
1. An object
2. An array
3. A date
03
Writing Basic JavaScript Codes
Menu Toggle
Menu Toggle - This code can be used to
toggle the menu on and off. This is useful
for creating a responsive navigation bar
that can be hidden on smaller screens.
Smooth Scroll
This code can be used to create a
smooth scroll effect when
clicking on links within the same
page.
Modal Popup
This code can be used to create a modal
popup that appears when a button is
clicked.
Interactive Forms
JavaScript can be used to make forms
more interactive, such as displaying an
error message if a field is invalid or
highlighting a field when it is selected.
Animation
Color cycle animation: You can create an
animation that cycles through a set of
colors, such as a rainbow effect. This can be
achieved by using an array of color values
and a setInterval function to change the
color of the element at a set interval.
THANK YOU FOR
LISTENING!

You might also like