Back to Modules

JavaScript Tutorial

Master JavaScript programming with our comprehensive tutorial. Learn through practical examples and hands-on coding exercises.

Part 1: JavaScript Fundamentals

Part 2: JavaScript Fundamentals

Introduction to JavaScript

JavaScript is a versatile programming language that enables interactive and dynamic web content. It's essential for modern web development.

Examples:

// Variables and Data Types
let name = "John";
const age = 25;
var isStudent = true;

// Basic Operations
console.log("Hello, " + name);
console.log(`Age: ${age}`);

Basic JavaScript syntax and string operations

Functions and Control Flow

Functions are reusable blocks of code, and control flow determines how your program executes.

Examples:

// Function Declaration
function greet(name) {
  return "Hello, " + name;
}

// Arrow Function
const multiply = (a, b) => a * b;

// Conditional Statements
if (age >= 18) {
  console.log("Adult");
} else {
  console.log("Minor");
}

Functions, arrow syntax, and conditional statements

Arrays and Objects

Arrays and objects are fundamental data structures in JavaScript for organizing and managing data.

Examples:

// Arrays
const fruits = ["apple", "banana", "orange"];
fruits.push("grape");
fruits.map(fruit => console.log(fruit));

// Objects
const person = {
  name: "John",
  age: 25,
  hobbies: ["reading", "gaming"],
  greet() {
    console.log("Hello!");
  }
};

Working with arrays and objects in JavaScript