Press ESC to close
๐Ÿš€ Complete JavaScript Course

JavaScript from Zero to Hero

Learn JavaScript step by step! From complete beginner to confident coder. Practice with interactive examples - no prior coding experience needed!

๐ŸŽฎ How to Learn JavaScript Here

  • Read the explanation for each concept
  • Look at the code example in the editor
  • Click โ–ถ Run Code to see what it does
  • Try changing the code and run it again!
  • Use quick buttons to try different examples
  • Press Ctrl + Enter to run code quickly
1๏ธโƒฃ

JavaScript Basics

๐Ÿค” What is JavaScript?

JavaScript is a programming language that makes websites interactive! It's like giving instructions to your computer.

๐Ÿ 

HTML

Structure (skeleton)

๐ŸŽจ

CSS

Style (clothes)

โšก

JavaScript

Behavior (brain)

๐Ÿ“ข Your First Code: console.log()

console.log() is how we print messages. It's like telling your computer to "speak" and show something!

๐Ÿ”‘ Key Point:

Everything inside console.log() will appear in the console output!

Try console.log()
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ“ฆ Variables - Storing Information

A variable is like a box where you store information. You give the box a name, and put something inside it!

let

Can be changed later

Use for most variables

const

Cannot be changed

Use for fixed values

var

Old way (avoid)

Don't use anymore

๐Ÿ”‘ Key Point:

Variable names should describe what's inside! Use camelCase like: myName, userAge, isLoggedIn

Practice: Variables
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿท๏ธ Data Types - Kinds of Information

JavaScript has different types of data. Think of it like different kinds of things you can put in boxes!

String

Text in quotes

"Hello", 'World'
Number

Any number

42, 3.14, -10
Boolean

true or false

true, false
Array

List of items

[1, 2, 3]
Object

Collection of data

{name: "Jo"}
undefined/null

Empty/nothing

undefined, null
Practice: Data Types
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
2๏ธโƒฃ

Operators

๐Ÿงฎ Math Operators

Just like a calculator! JavaScript can do all kinds of math.

+

Add

5 + 3 = 8

-

Subtract

10 - 4 = 6

*

Multiply

6 * 7 = 42

/

Divide

20 / 5 = 4

%

Remainder

10 % 3 = 1

**

Power

2 ** 3 = 8

++

Add 1

x++ โ†’ x+1

--

Minus 1

x-- โ†’ x-1

Practice: Math Operators
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
โš–๏ธ Comparison Operators

Compare values and get true or false!

===

Equal to

5 === 5 โ†’ true

!==

Not equal

5 !== 3 โ†’ true

>

Greater than

5 > 3 โ†’ true

<

Less than

3 < 5 โ†’ true

>=

Greater or equal

5 >= 5 โ†’ true

<=

Less or equal

3 <= 5 โ†’ true

โš ๏ธ Important:

Always use === (three equals), not == (two equals). Three equals is safer!

Practice: Comparison Operators
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ”— Logical Operators

Combine multiple conditions together!

&&

AND

Both must be true

true && true = true

true && false = false

||

OR

At least one true

true || false = true

false || false = false

!

NOT

Flips the value

!true = false

!false = true

Practice: Logical Operators
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
3๏ธโƒฃ

Conditionals (if/else)

๐Ÿšฆ Making Decisions with if/else

if/else lets your code make decisions! Like asking: "IF this is true, do this, ELSE do that"

if (condition) {
  // do this if condition is true
} else if (another condition) {
  // do this if first was false, but this is true
} else {
  // do this if all conditions are false
}

๐Ÿ”‘ Key Point:

The condition inside if() is checked. If it's true, the code inside {} runs!

Practice: if/else Statements
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
โ“ Ternary Operator - One Line if/else

A shorter way to write simple if/else in one line!

condition ? valueIfTrue : valueIfFalse

// Example:
let status = age >= 18 ? "adult" : "minor";
Practice: Ternary Operator
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ”€ Switch Statement

When you have many specific values to check, use switch!

Practice: Switch Statement
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
4๏ธโƒฃ

Loops - Repeat Actions

๐Ÿ”„ Why Use Loops?

Loops let you run the same code multiple times without writing it again and again!

for

When you know how many times

while

While condition is true

for...of

Loop through arrays

๐Ÿ”ข The for Loop
for (start; condition; step) {
  // code to repeat
}

// Example:
for (let i = 0; i < 5; i++) {
  console.log(i);  // prints 0, 1, 2, 3, 4
}
let i = 0

Start: where to begin

i < 5

Condition: when to stop

i++

Step: how to change

Practice: for Loop
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ” while Loop

Keeps running while the condition is true. Be careful of infinite loops!

while (condition) {
  // code runs while condition is true
  // make sure to change the condition!
}
Practice: while Loop
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ”Ÿ

Break & Continue - Loop Control

๐Ÿ›‘ break - Exit the Loop

break immediately exits the loop, skipping all remaining iterations!

When to use break:

  • โ€ข When you found what you're looking for
  • โ€ข To exit an infinite loop with a condition
  • โ€ข When an error or special case is detected
Practice: break Statement
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
โญ๏ธ continue - Skip to Next Iteration

continue skips the rest of the current iteration and jumps to the next one!

When to use continue:

  • โ€ข Skip invalid or unwanted items
  • โ€ข Filter out certain conditions
  • โ€ข Clean data processing
Practice: continue Statement
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿท๏ธ Labeled Statements - Control Nested Loops

Labels let you break or continue outer loops from inside nested loops!

Practice: Labeled break/continue
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
5๏ธโƒฃ

Functions - Reusable Code

๐Ÿ“ฆ What are Functions?

A function is like a recipe - a set of instructions you can use again and again!

๐Ÿ“

Define Once

Write the code once

๐Ÿ”„

Use Many Times

Call it whenever needed

๐Ÿ“ค

Return Results

Get values back

Practice: Basic Functions
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
โžก๏ธ Arrow Functions (Modern Way)

Arrow functions are a shorter, modern way to write functions!

// Traditional function
function add(a, b) {
  return a + b;
}

// Arrow function (same thing!)
const add = (a, b) => a + b;

// Arrow function with one parameter
const double = x => x * 2;

// Arrow function with body
const greet = (name) => {
  console.log("Hello " + name);
  return "Greeted!";
};
Practice: Arrow Functions
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
6๏ธโƒฃ

Arrays - Lists of Data

๐Ÿ“‹ What are Arrays?

An array is a list that holds multiple values! Like a shopping list or a playlist.

// Array syntax
let fruits = ["๐ŸŽ", "๐ŸŒ", "๐ŸŠ", "๐Ÿ‡"];
//  Index:      0      1      2      3

// Access by index (starts at 0!)
fruits[0]  // "๐ŸŽ" (first item)
fruits[2]  // "๐ŸŠ" (third item)

๐Ÿ”‘ Key Point:

Array indexes start at 0, not 1! The first item is at index 0.

Practice: Creating & Accessing Arrays
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
7๏ธโƒฃ

Powerful Array Methods

๐Ÿ—บ๏ธ map() - Transform Every Item

map() creates a new array by transforming each item!

const numbers = [1, 2, 3, 4, 5];
const doubled = numbers.map(n => n * 2);
// Result: [2, 4, 6, 8, 10]
Practice: map() Method
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ” filter() - Keep Only What You Want

filter() creates a new array with only the items that pass a test!

const numbers = [1, 2, 3, 4, 5, 6];
const evens = numbers.filter(n => n % 2 === 0);
// Result: [2, 4, 6]
Practice: filter() Method
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
โž• reduce() - Combine Into One Value

reduce() takes all items and combines them into a single value!

const numbers = [1, 2, 3, 4, 5];
const sum = numbers.reduce((total, n) => total + n, 0);
// Result: 15

// reduce(callback, startValue)
// callback: (accumulator, currentValue) => newAccumulator
Practice: reduce() Method
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ”Ž find() & findIndex() - Search for One

find() returns the first item that matches. findIndex() returns its position.

Practice: find() & includes()
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ”— Chaining Methods - Power Combo!

You can chain map(), filter(), and more together!

Practice: Chaining Array Methods
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
8๏ธโƒฃ

Objects - Organize Data

๐Ÿ“ฆ What are Objects?

An object stores data in key-value pairs. Like a person with name, age, job!

const person = {
  name: "John",      // key: value
  age: 25,
  isStudent: true,
  hobbies: ["coding", "gaming"]
};

// Access with dot or brackets
person.name      // "John"
person["age"]    // 25
Practice: Objects
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ”ง Object Methods

Objects can have functions too! They're called methods.

Practice: Object Methods
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ”‘ Object.keys(), Object.values(), Object.entries()

Get all keys, values, or key-value pairs from an object!

Practice: Object Methods (Built-in)
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
9๏ธโƒฃ

String Methods

๐Ÿ“ Working with Text

Strings have many useful methods for working with text!

.length

Count characters

.toUpperCase()

MAKE UPPERCASE

.toLowerCase()

make lowercase

.trim()

Remove spaces

.split()

Split into array

.includes()

Check if contains

.startsWith()

Check start

.endsWith()

Check end

.replace()

Replace text

Practice: String Methods
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ“ Template Literals - Modern Strings

Use backticks (`) to create strings with variables inside! Much easier than + concatenation.

const name = "Alice";
const age = 25;

// Old way (concatenation)
console.log("Hello, " + name + "! You are " + age + " years old.");

// New way (template literals) - Much cleaner! โœจ
console.log(`Hello, ${name}! You are ${age} years old.`);
Practice: Template Literals
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ”ข

Numbers & Math

๐Ÿ”ข Working with Numbers

JavaScript has powerful built-in methods for working with numbers and mathematical operations!

parseInt()

String to integer

parseFloat()

String to decimal

Number()

Convert to number

.toFixed(n)

Round to n decimals

isNaN()

Check if Not a Number

isFinite()

Check if finite

Practice: Number Methods
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ“…

Date & Time

๐Ÿ“… Working with Dates

The Date object lets you work with dates and times in JavaScript!

getFullYear()

Year (2024)

getMonth()

Month (0-11)

getDate()

Day (1-31)

getDay()

Weekday (0-6)

getHours()

Hours (0-23)

getMinutes()

Minutes (0-59)

getSeconds()

Seconds (0-59)

getTime()

Milliseconds

Practice: Date Object
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿš€ INTERMEDIATE JAVASCRIPT

Level up your skills with advanced concepts!

๐Ÿ”

Scope & Hoisting

๐Ÿ” Understanding Scope

Scope determines where variables are accessible in your code.

Global Scope

Accessible everywhere

Function Scope

Only inside function

Block Scope

Inside { } with let/const

Practice: Scope
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ”’

Closures Deep Dive

๐Ÿ”’ Understanding Closures

A closure is when a function "remembers" variables from its outer scope even after that scope has finished executing. This is one of the most powerful features in JavaScript!

Lexical Scope

Functions look up variables where they were defined, not where they're called

Data Privacy

Closures can create truly private variables

Practice: Closures
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ‘†

this & Context

๐Ÿ‘† Understanding this

The this keyword refers to the object that is executing the current function. Its value depends on HOW the function is called, not where it's defined!

Global

this = window (browser)

Method

this = object

Arrow

this = lexical (parent)

call/apply/bind

this = explicit

Practice: this Keyword
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐ŸŽฏ

Destructuring

๐ŸŽฏ Unpacking Values

Destructuring lets you extract values from arrays and objects into variables!

Practice: Destructuring
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
โณ

Async JavaScript

โณ Asynchronous Programming

JavaScript is single-threaded but can handle async operations without blocking!

Callbacks

Old way (callback hell ๐Ÿ˜ฑ)

Promises

Better! .then() chains

async/await

Best! Clean syntax โœจ

Practice: Async/Await
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ”„

Event Loop

๐Ÿ”„ Understanding the Event Loop

The Event Loop is how JavaScript handles asynchronous operations despite being single-threaded. It's essential knowledge for senior developers!

Call Stack

Executes synchronous code (LIFO)

Web APIs

Handles async operations

Task Queue

setTimeout, events (macrotasks)

Microtask Queue

Promises, queueMicrotask

Practice: Event Loop
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐ŸŒ

Fetch API

๐ŸŒ Making HTTP Requests

The fetch() API lets you make HTTP requests to servers and APIs!

Common HTTP Methods:

GETPOSTPUTDELETE
Practice: Fetch API
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ—ƒ๏ธ

Local Storage

๐Ÿ—ƒ๏ธ Browser Storage

localStorage lets you store data in the browser that persists even after closing!

localStorage

Persists forever (until cleared)

sessionStorage

Cleared when tab closes

Practice: Local Storage
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
โš ๏ธ

Error Handling

โš ๏ธ Handling Errors Gracefully

try/catch lets you handle errors without crashing your program!

try

Code that might fail

catch

Handle the error

finally

Always runs

Practice: Error Handling
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿงฉ

Higher-Order Functions & Currying

๐Ÿงฉ Functions That Use Functions

A higher-order function either takes a function as an argument or returns a function!Currying transforms a function with multiple arguments into a sequence of functions.

Practice: Higher-Order Functions & Currying
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ“ฆ

Modules

๐Ÿ“ฆ ES6 Modules

Modules let you split code into separate files and import/export between them!

export

Make code available to other files

import

Use code from other files

Module Patterns (Simulated)
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ”—

JSON

๐Ÿ”— JavaScript Object Notation

JSON is the standard format for sending data between servers and web apps!

JSON.stringify()

Object โ†’ String

JSON.parse()

String โ†’ Object

Practice: JSON
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ”ฅ ADVANCED JAVASCRIPT

Master the language with expert-level concepts!

๐Ÿ—๏ธ

Classes & OOP

๐Ÿ—๏ธ Object-Oriented Programming

Classes are blueprints for creating objects with shared properties and methods!

Practice: Classes
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐ŸŽญ

Prototypes

๐ŸŽญ Prototype Chain

Every JavaScript object has a prototype - another object it inherits from!

Practice: Prototypes
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ”ฎ

Symbols & Iterators

๐Ÿ”ฎ Unique Identifiers & Custom Iteration

Symbols are unique, immutable identifiers.Iterators define how objects are looped over!

Practice: Symbols & Iterators
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ“ก

Generators

๐Ÿ“ก Pausable Functions

Generators are functions that can be paused and resumed, producing a sequence of values!

Practice: Generators
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ—บ๏ธ

Map & Set

๐Ÿ—บ๏ธ Better Data Structures

Map and Set are more powerful than plain objects and arrays!

Map

Key-value pairs with any type as key

Set

Collection of unique values

Practice: Map & Set
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐ŸŽช

Proxy & Reflect

๐ŸŽช Metaprogramming

Proxy lets you intercept and customize operations on objects!

Practice: Proxy
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿงฌ

Regular Expressions

๐Ÿงฌ Pattern Matching

RegEx (Regular Expressions) are patterns for matching text!

\\d digit\\w word\\s space. any+ 1+* 0+? 0-1{n} n times
Practice: Regular Expressions
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
โšก

Performance

โšก Writing Fast JavaScript

Understanding performance helps you write faster, more efficient code!

Practice: Performance
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ›ก๏ธ

Security Best Practices

๐Ÿ›ก๏ธ Writing Secure JavaScript

Security is crucial! Learn common vulnerabilities and how to prevent them.

XSS

Cross-Site Scripting

Injection

SQL/Code Injection

CSRF

Cross-Site Request Forgery

Practice: Security
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿง 

Memory Management

๐Ÿง  JavaScript Memory & Garbage Collection

Understanding memory management is crucial for building performant applications. JavaScript uses automatic garbage collection, but memory leaks can still occur!

Stack

Primitives, function calls (fast, fixed size)

Heap

Objects, arrays (dynamic, GC managed)

Garbage Collection

Mark-and-sweep algorithm

Practice: Memory Management
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
โš™๏ธ

V8 Engine Internals

โš™๏ธ How JavaScript Engines Work

V8 is Google's JavaScript engine used in Chrome and Node.js. Understanding how it works helps you write faster code!

Parser

JS โ†’ AST

Ignition

Interpreter (bytecode)

TurboFan

JIT Compiler (optimized)

Deoptimization

Back to interpreter

Practice: V8 Optimization
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐ŸŒณ

DOM & Browser Events

๐ŸŒณ Event Propagation & DOM Manipulation

Understanding event propagation (bubbling & capturing) and efficient DOM manipulation is essential for building performant web applications.

Capturing โฌ‡๏ธ

Window โ†’ Document โ†’ Element (top-down)

Target ๐ŸŽฏ

Event reaches the clicked element

Bubbling โฌ†๏ธ

Element โ†’ Document โ†’ Window (bottom-up)

Practice: DOM Events
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ”ข

Functional Programming

๐Ÿ”ข Functional Programming Concepts

Functional programming (FP) is a paradigm that treats computation as evaluation of mathematical functions. It emphasizes immutability and pure functions.

Pure Functions

Same input โ†’ same output, no side effects

Immutability

Never mutate data, create new copies

First-Class Fns

Functions as values, arguments, returns

Declarative

What to do, not how to do it

Practice: Functional Programming
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ–ฅ๏ธ

Node.js Advanced

๐Ÿ–ฅ๏ธ Advanced Node.js Patterns

Node.js has powerful features for building scalable server-side applications. Understanding EventEmitter, Streams, and Worker Threads is essential!

EventEmitter

Pub/sub pattern for events

Streams

Process data chunk by chunk

Worker Threads

True multi-threading in Node

Practice: Node.js Patterns
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ”

WeakMap & WeakSet

๐Ÿ” Weak References for Memory Management

WeakMap and WeakSet hold weak references to objects. If an object has no other references, it can be garbage collected even if it's in a WeakMap!

WeakMap

Keys must be objects, values can be anything

WeakSet

Only stores objects, no duplicates

Practice: WeakMap & WeakSet
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
โฑ๏ธ

Microtasks vs Macrotasks

โฑ๏ธ Task Queue Priority

Understanding the difference between microtasks and macrotasks is crucial for predicting JavaScript execution order. Microtasks always run before macrotasks!

Microtasks (High Priority)

  • โ€ข Promise.then/catch/finally
  • โ€ข queueMicrotask()
  • โ€ข MutationObserver

Macrotasks (Lower Priority)

  • โ€ข setTimeout/setInterval
  • โ€ข setImmediate (Node)
  • โ€ข I/O, UI rendering
Practice: Task Priority
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ“‹

Deep vs Shallow Copy

๐Ÿ“‹ Object Cloning Techniques

Understanding the difference between shallow and deep copying is essential for avoiding unexpected mutations!

Shallow Copy

Copies top-level properties only. Nested objects are shared!

Deep Copy

Recursively copies all nested objects. Completely independent!

Practice: Copying Objects
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐ŸŽจ

Design Patterns

๐ŸŽจ Common JavaScript Design Patterns

Design patterns are proven solutions to common programming problems. They make code more maintainable, reusable, and scalable.

Creational

Singleton, Factory, Builder

Structural

Module, Decorator, Facade

Behavioral

Observer, Mediator, Strategy

Practice: Design Patterns
script.js
Console Output

Click "Run Code" or press Ctrl+Enter to see output...

Press Ctrl + Enter to run code
๐Ÿ“‹ Quick Reference Cheat Sheet

Variables

let x = 10;const PI = 3.14;

Arrays

let arr = [1, 2, 3];arr.push(4);

Objects

let obj = {name: "Jo"};obj.name;

Functions

function add(a,b){ย ย return a + b;}

Arrow Functions

const add = (a,b) => a + b;

Array Methods

arr.map(x => x * 2)arr.filter(x => x > 5)arr.reduce((a,b) => a+b)
๐ŸŽ‰

Congratulations!

You've learned the fundamentals of JavaScript! Keep practicing and building projects!

๐Ÿ’ก Pro tip: The best way to learn is by doing. Try modifying all the examples above!