JS 1
JS 1
Developmen
t
Week 2 Class 1
HTML5 Continuation
Web
Development
JavaScript Class
1
Intro. To JavaScript
Tutor Profile
Email:
[email protected]
Linkedin: linkedin.com/
promiseokechukwu
WhatsApp: +2347012897856
Learning Agenda
01 Introduction to JavaScript
• Versatility: JavaScript is not only used on the client-side but can also
be used on the server-side (e.g., with Node.js), allowing full-stack
development with a single language.
02
DATA TYPES,
VARIABLES &
OPERATORS
• Numbers: Represent both integer and floating-point
numbers. DATA TYPES
Example: let age = 25; or let pi = 3.14;
• Strings: A sequence of characters used to represent
text.
Example: let name = "John Doe";
• Booleans: Represents logical values: true or false.
Example: let isStudent = true;
• Objects: Complex data structures used to store
collections of data.
Example: let person = { firstName: "John",
lastName: "Doe" };
• Null: Represents an intentionally empty or non-
existent value.
• Undefined: Indicates a variable that has been
OPERATORS
Operators in JavaScript are symbols that are used to perform
operations on variables and values. They are fundamental to
manipulating data in JavaScript, allowing you to perform arithmetic
calculations, comparisons, logical operations, and more.
Arithmetic Operators:
Used for mathematical calculations: +, -, *, /, %.
Comparison Operators:
Compare values: ==, ===, !=, !==, <, >, <=, >=.
Example: let isEqual = (5 === 5);
Logical Operators:
Combine or invert Boolean values: && (AND), || (OR), ! (NOT).
Example: let result = (true && false);
Ternary Operator:
A shorthand for if-else conditions: condition ? expr1 : expr2;
Example: let status = (age >= 18) ? "Adult" : "Minor";
VARIABLES
Variables in JavaScript are containers for storing data values.
They are fundamental to programming, allowing you to label
and store information in your code that you can later
reference and manipulate.
Key Concepts:
Declaration:
let: Block-scoped variable declaration.
const: Block-scoped constant declaration.
var: Function-scoped (legacy) variable declaration.
Assignment:
Assign values to variables using the = operator.
Example: let color = "blue";
00
Ice - Breaker
Ice - Breaker
Conditional Expressions:
• If statement
• If-else statement
CONTROL FLOW (CONDITIONAL STATEMENTS)
• else-if statement
• switch statement
00
Summary
SUMMARY
SUMMARY
Resource materials
https://www.w3schools.com/js/
https://www.freecodecamp.org/news/learn-javascript-for-beginners/
00
Class Task
Class Task
1. Create a program that asks the user for their score in a test (between 0
and 100).
Use an else if ladder to determine and display the grade:
• 75 to 89: "Grade: B"
• 50 to 74: "Grade: C"
• 35 to 49: "Grade: D"
• Below 35: "Grade: F"
• 90 and above: "Grade: A"
2. Use a switch statement to display the name of the
corresponding day.
• Write a program that takes a number between 1 and 7 from the
user, where 1 represents Monday and 7 represents Sunday.
00
Assignment
Assignment
1. Loops in JavaScript
2. Functions
THANKS!
ANY QUESTIONS?
[email protected]
+234 8020 421 838
https://lmtechub.org
lmtechub
lmtechies
lm-tech-hub
lmtechub