JAVASCRIPT
WEEK ONE
LESSON ONE: DATA TYPES AND JAVASCRIPT SYNTAX
Tasks:
Task 1: Create and manipulate strings 10 marks
● Create a variable name and assign it a string value.
● Use string concatenation to create a new string that includes the
name variable.
● Use string methods like toUpperCase(), toLowerCase(), and slice()
to manipulate the string.
Task 2: Perform arithmetic operations with numbers 10 marks
● Create variables num1 and num2 and assign them numeric values.
● Perform addition, subtraction, multiplication, and division
operations using these variables.
● Use the modulus operator to find the remainder of dividing num1
by num2.
Task 3: Work with booleans and logical operators 10 marks
● Create variables isTrue and isFalse and assign them boolean
values.
● Use logical operators (&&, ||, !) to combine and manipulate the
boolean values.
● Write conditions using if statements to perform actions based on
the boolean values.
Task 4: Create and manipulate arrays 10 marks
● Create an array numbers with a list of numbers.
● Access and print the value of a specific element in the array.
● Use array methods like push(), pop(), shift(), and unshift() to
add or remove elements.
Task 5: Work with objects 10 marks
● Create an object person with properties like name, age, and
location.
● Access and print the values of specific properties in the object.
● Add or update properties in the object using dot notation or
bracket notation.
Task 6: Convert between data types 10 marks
● Convert a string to a number using the parseInt() or
parseFloat() functions.
● Convert a number to a string using the toString() method or
string concatenation.
● Convert a string to an array using the split() method.
Task 7: Practice type checking and comparison 10 marks
● Use the typeof operator to check the type of a variable.
● Compare two values using the equality (==) and strict equality
(===) operators.
● Understand the difference between truthy and falsy values in
JavaScript.
Task 8: Explore undefined and null 10 marks
● Declare a variable without assigning a value to it and observe
the output.
● Assign null to a variable and check its type using the typeof
operator.
Task 9: Use template literals 10 marks
● Create a template literal that includes variables and text.
● Interpolate variables into the template using ${}.
Task 10: Practice console logging and debugging 10 marks
● Use console.log() to print values and debug your code.
● Utilize console.warn() and console.error() to display warnings
and error messages.
LESSON TWO: DATA TYPES AND JAVASCRIPT SYNTAX
Tasks:
Task 1: Create an "if" statement 10 marks
● Declare a variable and assign it a numeric value.
● Write an "if" statement that checks if the value is greater than
10.
● If the condition is true, log a message to the console.
Task 2: Use "if-else" statements 10 marks
● Declare a variable and assign it a numeric value.
● Write an "if-else" statement that checks if the value is even.
● If the condition is true, log a message stating that the number is
even; otherwise, log a message stating that the number is odd.
Task 3: Use "if-else if-else" statements 10 marks
● Declare a variable and assign it a numeric value.
● Write an "if-else if-else" statement to check the range of the
value.
● If the value is less than 0, log a message stating that it is
negative.
● If the value is greater than 0, log a message stating that it is
positive.
● If neither condition is met, log a message stating that it is zero.
Task 4: Nest "if" statements 10 marks
● Declare two variables, num1 and num2, and assign them numeric
values.
● Write an outer "if" statement to check if num1 is greater than 0.
● Inside the "if" block, write an inner "if" statement to check if num2
is greater than 0.
● If both conditions are true, log a message stating that both
numbers are positive.
Task 5: Use the ternary operator 10 marks
● Declare a variable and assign it a numeric value.
● Use the ternary operator to check if the value is greater than 10.
● If the condition is true, log a message stating that it is greater
than 10; 2otherwise, log a message stating that it is less than or
equal to 10.
Task 6: Compare multiple conditions with logical operators 30 marks
● Declare a variable and assign it a numeric value.
● Write a compound condition using logical operators to check if
the value is between 5 and 10 (inclusive).
● If the condition is true, log a message stating that the value is in
the specified range; otherwise, log a message stating that it is
outside the range.
Task 7: Use the "switch" statement 20 marks
● Declare a variable and assign it a string value representing a day
of the week.
● Write a "switch" statement to perform different actions based on
the day.
● Log a message with a specific action for each day (e.g., "Monday:
Start of the week").
LESSON THREE: LOOPS AND CONDITIONAL
Tasks:
Task 1: Use a "for" loop to iterate over an array
● Create an array of numbers.
● Use a "for" loop to iterate over the array and log each number to the
console.
Task 2: Use a "for" loop to iterate in reverse
● Create an array of strings.
● Use a "for" loop to iterate over the array in reverse and log each string
to the console.
Task 3: Use a "for...in" loop to iterate over an object
● Create an object with key-value pairs representing personal
information (name, age, city, etc.).
● Use a "for...in" loop to iterate over the object and log each key-value
pair to the console.
Task 4: Use a "while" loop with a condition
● Declare a variable with an initial value.
● Use a "while" loop with a condition to increment the variable until it
reaches a specified value.
● Log the value of the variable at each iteration.
Task 5: Use a "do...while" loop
● Declare a variable with an initial value.
● Use a "do...while" loop to increment the variable until it reaches a
specified value.
● Log the value of the variable at each iteration.
Task 6: Use the "break" statement
● Create a loop that counts from 1 to 10.
● Use an "if" statement to check if the current iteration is 5.
● If the condition is true, use the "break" statement to exit the loop.
Task 7: Use the "continue" statement
● Create a loop that counts from 1 to 10.
● Use an "if" statement to check if the current iteration is divisible by 2.
● If the condition is true, use the "continue" statement to skip the
current iteration and move to the next.
Task 8: Use nested loops
● Create a nested loop structure to generate a multiplication table.
● Use two "for" loops to iterate over values from 1 to 10 and calculate
the product of each combination.
Task 9: Use array methods for iteration
● Create an array of names.
● Use array methods like forEach(), map(), or filter() to perform specific
actions on the array elements.
Task 10: Use "for...of" loop for iterable objects
● Create an iterable object, such as an array or string.
● Use a "for...of" loop to iterate over the elements of the object and
perform actions