Basic JavaScript Syntax and Data Types

Intermediate

📘 Understanding JavaScript Syntax & Data Types

Understanding JavaScript syntax and data types is crucial for writing functional code. Elements include variables, operators, functions, and control structures.


🧠 Variables

Variables are declared using var, let, or const.

let age = 30;
const name = 'Alice';

📦 Data Types

  • 🔢 Number
  • 📝 String
  • Boolean
  • 🚫 Null
  • Undefined
  • 🧱 Object
  • 🧿 Symbol

⚙️ Basic Operators

  • ➕➖✖️➗ Arithmetic: +, -, *, /
  • 📝 Assignment: =, +=
  • 🧮 Comparison: ==, ===, <, >
  • 🔗 Logical: &&, ||, !

Sample code:

let isAdult = age >= 18; // Boolean
console.log('Is adult:', isAdult); // Output: true

This foundation allows developers to build complex logic from simple expressions.