Search...
⌘K
Search...
⌘K
Rules & Conduct
JavaScript syntax defines the set of rules for writing valid JavaScript code. It consists of statements, expressions, operators, and control structures that determine how the script is executed.
A JavaScript program consists of a sequence of statements. Each statement performs an action and is typically written on a new line.
Example:
console.log("Hello, World!"); // Outputs text to the console let x = 10; // Variable declaration x += 5; // Arithmetic operation
JavaScript statements can be terminated with a semicolon (;), though it is optional in most cases.
Comments are used to document code and prevent execution of specific lines.
Single-line comment:
Multi-line comment:
Variables store data values and can be declared using var, let, or const.
let name = "John"; // String variable var age = 25; // Number variable const PI = 3.14; // Constant (cannot be reassigned)
let – Block-scoped variable (recommended for most use cases).
var – Function-scoped variable (older syntax, avoid using it in modern development).
const – Block-scoped, immutable variable (cannot be reassigned).
Must begin with a letter, underscore (_), or dollar sign ($).
Cannot use reserved JavaScript keywords.
Case-sensitive (myVariable and MyVariable are different).
JavaScript is dynamically typed, meaning variables do not have fixed types.
JavaScript has six primitive types:
String – "Hello"
Number – 42, 3.14
Boolean – true, false
Undefined – A variable that has been declared but not assigned a value
Null – Represents an intentional absence of value
Symbol – Unique and immutable identifier (used in advanced programming)
Example:
let text = "JavaScript"; // String let count = 100; // Number let isAvailable = true; // Boolean let value; // Undefined let empty = null; // Null
Objects – Collections of key-value pairs.
Arrays – Ordered lists of values.
Functions – Blocks of reusable code.
Example:
let person = { name: "Alice", age: 30 }; // Object let numbers = [1, 2, 3, 4, 5]; // Array function greet() { console.log("Hello!"); } // Function
JavaScript includes several types of operators:
Used for mathematical operations.
let a = 10, b = 5; console.log(a + b); // Addition (15) cnsole.log(a - b); // Subtraction (5) console.log(a * b); // Multiplication (50) console.log(a / b); // Division (2) console.log(a % b); // Modulus (0)
Used for value comparisons.
console.log(10 > 5); // true console.log(10 < 5); // false c0nsole.log(10 == "10"); // true (loose equality) console.log(10 === "10"); // false (strict equality) console.log(10 !== 5); // true (not equal)
Used to combine multiple conditions.
console.log(true && false); // false (AND) console.log(true || false); // true (OR) console.log(!true); // false (NOT)
This page introduced JavaScript syntax, variables, data types, and operators. In the next section, we will explore control flow structures like conditionals and loops to build more complex logic.
A JavaScript program consists of a sequence of statements. Each statement performs an action and is typically written on a new line.
Example:
console.log("Hello, World!"); // Outputs text to the console let x = 10; // Variable declaration x += 5; // Arithmetic operation
JavaScript statements can be terminated with a semicolon (;), though it is optional in most cases.
Comments are used to document code and prevent execution of specific lines.
Single-line comment:
Multi-line comment:
Variables store data values and can be declared using var, let, or const.
let name = "John"; // String variable var age = 25; // Number variable const PI = 3.14; // Constant (cannot be reassigned)
let – Block-scoped variable (recommended for most use cases).
var – Function-scoped variable (older syntax, avoid using it in modern development).
const – Block-scoped, immutable variable (cannot be reassigned).
Must begin with a letter, underscore (_), or dollar sign ($).
Cannot use reserved JavaScript keywords.
Case-sensitive (myVariable and MyVariable are different).
JavaScript is dynamically typed, meaning variables do not have fixed types.
JavaScript has six primitive types:
String – "Hello"
Number – 42, 3.14
Boolean – true, false
Undefined – A variable that has been declared but not assigned a value
Null – Represents an intentional absence of value
Symbol – Unique and immutable identifier (used in advanced programming)
Example:
let text = "JavaScript"; // String let count = 100; // Number let isAvailable = true; // Boolean let value; // Undefined let empty = null; // Null
Objects – Collections of key-value pairs.
Arrays – Ordered lists of values.
Functions – Blocks of reusable code.
Example:
let person = { name: "Alice", age: 30 }; // Object let numbers = [1, 2, 3, 4, 5]; // Array function greet() { console.log("Hello!"); } // Function
JavaScript includes several types of operators:
Used for mathematical operations.
let a = 10, b = 5; console.log(a + b); // Addition (15) cnsole.log(a - b); // Subtraction (5) console.log(a * b); // Multiplication (50) console.log(a / b); // Division (2) console.log(a % b); // Modulus (0)
Used for value comparisons.
console.log(10 > 5); // true console.log(10 < 5); // false c0nsole.log(10 == "10"); // true (loose equality) console.log(10 === "10"); // false (strict equality) console.log(10 !== 5); // true (not equal)
Used to combine multiple conditions.
console.log(true && false); // false (AND) console.log(true || false); // true (OR) console.log(!true); // false (NOT)
This page introduced JavaScript syntax, variables, data types, and operators. In the next section, we will explore control flow structures like conditionals and loops to build more complex logic.
Join our Community Forum
Any other questions? Get in touch
Rules & Conduct
JavaScript syntax defines the set of rules for writing valid JavaScript code. It consists of statements, expressions, operators, and control structures that determine how the script is executed.
A JavaScript program consists of a sequence of statements. Each statement performs an action and is typically written on a new line.
Example:
console.log("Hello, World!"); // Outputs text to the console let x = 10; // Variable declaration x += 5; // Arithmetic operation
JavaScript statements can be terminated with a semicolon (;), though it is optional in most cases.
Comments are used to document code and prevent execution of specific lines.
Single-line comment:
Multi-line comment:
Variables store data values and can be declared using var, let, or const.
let name = "John"; // String variable var age = 25; // Number variable const PI = 3.14; // Constant (cannot be reassigned)
let – Block-scoped variable (recommended for most use cases).
var – Function-scoped variable (older syntax, avoid using it in modern development).
const – Block-scoped, immutable variable (cannot be reassigned).
Must begin with a letter, underscore (_), or dollar sign ($).
Cannot use reserved JavaScript keywords.
Case-sensitive (myVariable and MyVariable are different).
JavaScript is dynamically typed, meaning variables do not have fixed types.
JavaScript has six primitive types:
String – "Hello"
Number – 42, 3.14
Boolean – true, false
Undefined – A variable that has been declared but not assigned a value
Null – Represents an intentional absence of value
Symbol – Unique and immutable identifier (used in advanced programming)
Example:
let text = "JavaScript"; // String let count = 100; // Number let isAvailable = true; // Boolean let value; // Undefined let empty = null; // Null
Objects – Collections of key-value pairs.
Arrays – Ordered lists of values.
Functions – Blocks of reusable code.
Example:
let person = { name: "Alice", age: 30 }; // Object let numbers = [1, 2, 3, 4, 5]; // Array function greet() { console.log("Hello!"); } // Function
JavaScript includes several types of operators:
Used for mathematical operations.
let a = 10, b = 5; console.log(a + b); // Addition (15) cnsole.log(a - b); // Subtraction (5) console.log(a * b); // Multiplication (50) console.log(a / b); // Division (2) console.log(a % b); // Modulus (0)
Used for value comparisons.
console.log(10 > 5); // true console.log(10 < 5); // false c0nsole.log(10 == "10"); // true (loose equality) console.log(10 === "10"); // false (strict equality) console.log(10 !== 5); // true (not equal)
Used to combine multiple conditions.
console.log(true && false); // false (AND) console.log(true || false); // true (OR) console.log(!true); // false (NOT)
This page introduced JavaScript syntax, variables, data types, and operators. In the next section, we will explore control flow structures like conditionals and loops to build more complex logic.
Join our Community Forum
Any other questions? Get in touch
Rules & Conduct
JavaScript syntax defines the set of rules for writing valid JavaScript code. It consists of statements, expressions, operators, and control structures that determine how the script is executed.
A JavaScript program consists of a sequence of statements. Each statement performs an action and is typically written on a new line.
Example:
console.log("Hello, World!"); // Outputs text to the console let x = 10; // Variable declaration x += 5; // Arithmetic operation
JavaScript statements can be terminated with a semicolon (;), though it is optional in most cases.
Comments are used to document code and prevent execution of specific lines.
Single-line comment:
Multi-line comment:
Variables store data values and can be declared using var, let, or const.
let name = "John"; // String variable var age = 25; // Number variable const PI = 3.14; // Constant (cannot be reassigned)
let – Block-scoped variable (recommended for most use cases).
var – Function-scoped variable (older syntax, avoid using it in modern development).
const – Block-scoped, immutable variable (cannot be reassigned).
Must begin with a letter, underscore (_), or dollar sign ($).
Cannot use reserved JavaScript keywords.
Case-sensitive (myVariable and MyVariable are different).
JavaScript is dynamically typed, meaning variables do not have fixed types.
JavaScript has six primitive types:
String – "Hello"
Number – 42, 3.14
Boolean – true, false
Undefined – A variable that has been declared but not assigned a value
Null – Represents an intentional absence of value
Symbol – Unique and immutable identifier (used in advanced programming)
Example:
let text = "JavaScript"; // String let count = 100; // Number let isAvailable = true; // Boolean let value; // Undefined let empty = null; // Null
Objects – Collections of key-value pairs.
Arrays – Ordered lists of values.
Functions – Blocks of reusable code.
Example:
let person = { name: "Alice", age: 30 }; // Object let numbers = [1, 2, 3, 4, 5]; // Array function greet() { console.log("Hello!"); } // Function
JavaScript includes several types of operators:
Used for mathematical operations.
let a = 10, b = 5; console.log(a + b); // Addition (15) cnsole.log(a - b); // Subtraction (5) console.log(a * b); // Multiplication (50) console.log(a / b); // Division (2) console.log(a % b); // Modulus (0)
Used for value comparisons.
console.log(10 > 5); // true console.log(10 < 5); // false c0nsole.log(10 == "10"); // true (loose equality) console.log(10 === "10"); // false (strict equality) console.log(10 !== 5); // true (not equal)
Used to combine multiple conditions.
console.log(true && false); // false (AND) console.log(true || false); // true (OR) console.log(!true); // false (NOT)
This page introduced JavaScript syntax, variables, data types, and operators. In the next section, we will explore control flow structures like conditionals and loops to build more complex logic.
Join our Community Forum
Any other questions? Get in touch



The Tournament Alif x Replit
·
©
2026
All rights reserved
