JavaScript Syntax Essentials - CodingQue

JavaScript Syntax Essentials

JavaScript syntax is the set of rules defining how JavaScript code should be written.

1. Variables

Variables are used to store data values. In JavaScript, there are three main ways to declare a variable:

let name = "Alice";   // Using let
const age = 25;     // Using const
var city = "New York"; // Using var

2. Data Types

JavaScript supports several data types for storing different types of values. Common data types include:

let greeting = "Hello"; // String
let count = 10;         // Number
let isLoggedIn = true;  // Boolean

3. Basic Operators

Operators are symbols used to perform operations on variables and values. Here are some common types:

let sum = 5 + 3;        // Addition
let isEqual = (5 === 5); // Logical comparison
Previous Next
Modern Footer