Reference Guide

Table of Contents

  1. Introduction to JavaScript

  2. Variables and Data Types

  3. Operators

  4. Control Structures

  5. Functions

  6. Arrays

  7. Objects

  8. DOM Manipulation

  9. Events

  10. Modern JavaScript (ES6+)

  11. Asynchronous JavaScript

  12. Best Practices


Introduction to JavaScript

What is JavaScript?

JavaScript is a high-level, interpreted programming language that enables interactive web pages. It's one of the core technologies of the web alongside HTML and CSS.

Key Characteristics

  • Client-side scripting: Runs in the browser

  • Dynamic typing: Variables can change types

  • Event-driven: Responds to user actions

  • Asynchronous: Handles operations without blocking

Adding JavaScript to HTML

External (BEST PRACTICE):

Internal:

Console Output


Variables and Data Types

Variable Declaration

Primitive Data Types

String

Number

Boolean

Undefined and Null

Type Conversion


Operators

Arithmetic

Comparison

Logical

Ternary


Control Structures

If-Else

Switch

Loops

For Loop

While Loop

For...of (ES6)

For...in


Functions

Function Declaration

Arrow Functions (ES6)

Rest Parameters

Closures

Higher-Order Functions


Arrays

Creating and Accessing

Modifying Arrays

Array Methods

splice() - Add/Remove

slice() - Extract

map() - Transform

filter() - Select

reduce() - Accumulate

find() and findIndex()

some() and every()

sort()

Spread Operator

Destructuring


Objects

Creating Objects

Accessing Properties

Modifying Objects

Object Methods

Object Iteration

Spread Operator

Destructuring

JSON


DOM Manipulation

Selecting Elements

Modifying Content

Modifying Attributes

Modifying Styles

CSS Classes

Creating Elements

Traversing DOM


Events

Adding Event Listeners

Mouse Events

Keyboard Events

Form Events

Event Object

Event Delegation


Modern JavaScript (ES6+)

Template Literals

Destructuring

Spread and Rest

Enhanced Object Literals

Classes

Optional Chaining


Asynchronous JavaScript

setTimeout and setInterval

Promises

Async/Await

Fetch API


Best Practices

Code Organization

Naming Conventions

Code Quality

Performance

Security


Last updated