JavaScript

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

Key Features

Dynamic Typing Variables can hold any type of value.

First-Class Functions Functions are treated as values and can be passed as arguments.

Prototype-Based Objects inherit directly from other objects.

Event-Driven Responds to user interactions and browser events.

Basic Syntax

javascript
// Variables
const name = 'John'
let age = 30
var oldStyle = 'avoid'

// Functions
function greet(name) {
  return `Hello, ${name}!`
}

// Arrow function
const add = (a, b) => a + b

// Objects
const person = {
  name: 'Jane',
  age: 25,
  greet() {
    console.log(`Hi, I'm ${this.name}`)
  }
}

// Arrays
const numbers = [1, 2, 3, 4, 5]
numbers.map(n => n * 2)

Modern JavaScript (ES6+)

  • Arrow functions
  • Template literals
  • Destructuring
  • Spread/rest operators
  • Promises and async/await
  • Classes
  • Modules

Environments

  • Browser: Client-side interactivity
  • Node.js: Server-side applications
  • React Native: Mobile applications
  • Electron: Desktop applications

Learn More