JavaScript: Your First Steps in
Programming
An incredible journey starts here! Let's explore the fundamentals of the
language that brings interactivity to the web.
What Is JavaScript?
The Language of the Interactivity
Web Creates animations, responds to
It brings web pages to life, mouse clicks, processes forms,
transforming static documents and much more.
into dynamic and interactive
experiences.
Cross-Platform
Used in browsers, [Link] servers, and even mobile and desktop
applications.
Thinking Like a Programmer
Programming Is Problem Solving
It's not just about writing code - it's about analyzing what we
want to build and how we're going to do it efficiently.
Practical Example
Imagine creating a simple "Guess the Number" game: we need
to think about how to generate a random number, receive the
player's input, compare values, and give feedback.
Variables: Memory Boxes
What Are Variables?
1 They store information that can change during program
execution. They are like boxes that hold data.
How Do You Declare Them?
2
We use let to create variables that can be reassigned later.
Practical Example
3 let age = 25; creates a variable called "age" and stores the value
25 in it.
Declaring Variables with
Basic Data Types
Numbers Strings (Text) Booleans
Whole or decimal values: 10, 3.14, -5, 0 Sequences of characters in quotes: Logical values: true (true) or false (false)
"Hello", 'JavaScript', "123"
Used for mathematical calculations and Essential for decisions and conditions in
counting. Can use single or double quotes. code.
Arithmetic Operators
Operators allow us to perform mathematical calculations with our variables:
Addition + Subtraction - Multiplication *
Combines two values: 5 + 3 results in Subtracts one value from another: 10 - Multiplies values: 3 * 4 results in 12
8 4 results in 6
Division / Modulo %
Divides values: 15 / 3 results in 5 Remainder of division: 10 % 3 results in 1
The Challenge: Adding
Variables!
Step 1
Create two numeric variables with values of your choice
Step 2
Use the addition operator (+) to add these variables
Step 3
Store the result in a new variable
Step 4
Display the result in the browser console
Hands On!
Let's implement the challenge together, step by step:
1 2 3
Declare the Variables Calculate the Sum Display the Result
let number1 = 10; let sum = number1 + number2; [Link](sum);
let number2 = 20;
We use the + operator to add the Prints the sum value in the browser
We create two variables and assign variables and store the result. console (F12 to view).
numbers to them.
Expected Result: The console will show 30 (10 + 20)
Congratulations! You
Programmed in JavaScript!
Your Learnings Challenge Completed
You explored variables, basic You successfully
data types, and arithmetic implemented a program that
operators — the foundational declares variables, performs
pillars of programming! calculations, and displays
results!
Next Steps
Keep practicing! Try changing the values, adding more operations, and
exploring other concepts. The more you practice, the more natural it
becomes!
"The best time to start was yesterday. The second best time is now!"