Course Content
JavaScript Fundamentals: Part 1
JavaScript is a versatile and widely-used programming language that is essential for creating interactive web applications. This guide covers the fundamental concepts you need to start coding in JavaScript.
0/6
The Complete JavaScript Course 2024
About Lesson

Basic Assignments

  1. Simple Variables

    • Task: Declare variables using let and const to store your name, age, and whether you are a student.
    • Example:
      javascript

      let name = "John";
      const age = 25;
      let isStudent = true;
  2. Basic Operations

    • Task: Declare two variables to store two numbers. Calculate and print the sum, difference, product, and quotient.
    • Example:
      javascript

      let num1 = 10;
      let num2 = 5;
      console.log(num1 + num2); // Sum
      console.log(num1 - num2); // Difference
      console.log(num1 * num2); // Product
      console.log(num1 / num2); // Quotient
  3. String Concatenation

    • Task: Create variables to store your first name and last name. Concatenate them to form your full name and print it.
    • Example:
      javascript

      let firstName = "John";
      let lastName = "Doe";
      let fullName = firstName + " " + lastName;
      console.log(fullName);

Intermediate Assignments

  1. Array Manipulation

    • Task: Create an array to store the names of five friends. Add a new name to the array and remove the last name from the array. Print the updated array.
    • Example:
      javascript

      let friends = ["Alice", "Bob", "Charlie", "David", "Eve"];
      friends.push("Frank");
      friends.pop();
      console.log(friends);
  2. Object Creation and Access

    • Task: Create an object to store information about a car (make, model, year). Access and print each property of the object.
    • Example:
      javascript

      let car = {
      make: "Toyota",
      model: "Camry",
      year: 2021
      };
      console.log(car.make);
      console.log(car.model);
      console.log(car.year);
  3. Function Declaration

    • Task: Declare a function that takes two numbers as arguments and returns their sum. Call the function with different pairs of numbers and print the results.
    • Example:
      javascript

      function addNumbers(a, b) {
      return a + b;
      }
      console.log(addNumbers(5, 3));
      console.log(addNumbers(10, 20));

Advanced Assignments

  1. Object Array Manipulation

    • Task: Create an array of objects, where each object represents a student with properties: name, age, and grade. Write a function to calculate the average grade of the students.
    • Example:
      javascript

      let students = [
      { name: "Alice", age: 20, grade: 85 },
      { name: "Bob", age: 22, grade: 90 },
      { name: "Charlie", age: 23, grade: 95 }
      ];
      function averageGrade(students) {
      let total = 0;
      for (let student of students) {
      total += student.grade;
      }
      return total / students.length;
      }
      console.log(averageGrade(students));
Join the conversation