Skip to content

JavaScript

Master modern JavaScript for interactive web applications.

Quick Start

New to JavaScript? Start here:

Core Learning

Fundamentals

Best Practices

Required Tools Setup

Before coding, install these tools:

  • Node.js - JavaScript runtime (Download)
  • npm - Package manager (comes with Node.js)
  • nvm - Node Version Manager (Install Guide)
# Check installations
node --version
npm --version
nvm --version

Practice Problems

Problem 1: Fix the Array Sum Function 🐛

Bug: This code has an off-by-one error. Find and fix it!

function sumArray(arr) {
  let sum = 0;
  for (let i = 0; i <= arr.length; i++) {  // ⚠️ Bug here!
    sum += arr[i];
  }
  return sum;
}

console.log(sumArray([1, 2, 3, 4])); // Expected: 10
💡 Hint Array indices go from 0 to length-1. What happens when i equals arr.length?

Problem 2: JavaScript Type Coercion 🔄

Predict the output:

let a = 3;
let b = "3";

console.log(a + b);  // ?
console.log(b + a);  // ?
console.log(b * a);  // ?
console.log(a * b);  // ?
console.log(a / b);  // ?
console.log(b / a);  // ?
console.log(a - b);  // ?
console.log(b - a);  // ?

Question: Why do + and - operators behave differently?

🤔 Deep Dive Topics

Master these JavaScript concepts:

  • Closures - Functions that remember their scope
  • Event Loop - How JavaScript handles async operations
  • null vs undefined - Type differences and use cases
  • Hoisting - Variable and function declarations
  • Promises & Async/Await - Modern asynchronous programming

Test Your Knowledge

Take the JavaScript Quiz →

Goal: Score 70% or higher