JavaScript Basics Assignment
Objective:
To reinforce the understanding of JavaScript fundamentals, including variables, data
types, operators, control structures.
Part 1: Variables and Data Types
1. Task 1: Declare three variables named firstName, lastName, and age. Assign
them appropriate values that represent your first name, last name, and age.
2. Task 2: Create a new variable fullName by concatenating firstName and lastName.
Print fullName to the console.
3. Task 3: Declare a variable isAdult and assign it a value based on whether age
is greater than or equal to 18. Print isAdult to the console.
Part 2: Operators
1. Task 4: Create a simple calculator that performs addition, subtraction,
multiplication, and division on two numbers num1 and num2. Print the results to
the console.
2. Task 5: Use the modulus operator to determine if num1 is even or odd. Print
the result to the console.
Part 3: Control Structures
1. Task 6: Write a script that checks the value of age and prints a message
indicating whether the person is a child, teenager, adult, or senior.
2. Task 7: Write a for loop that prints numbers from 1 to 10 to the console.
3. Task 8: Write a while loop that prints all even numbers between 1 and 20.