Data Types
- Integers: Whole numbers, e.g., 1, 2, 3, etc.
- Floats: Decimal numbers, e.g., 3.14, -0.5, etc.
- Strings: Text, e.g., "Hello", 'Hello', etc. Strings can be enclosed in single quotes or double
quotes.
- Boolean: True or False values
- Arrays: Collections of values, e.g., [1, 2, 3], ["a", "b", "c"], etc.
- Objects: Collections of key-value pairs, e.g., {"name": "John", "age": 30}, etc.
Loops
- For Loop: Used to iterate over a sequence (e.g., array, string) for a specified number of times.
- While Loop: Used to execute a block of code as long as a specified condition is true.
- Do-While Loop: Similar to the while loop, but the code block is executed at least once.
Operators
- Arithmetic Operators:
- Addition: `a + b`
- Subtraction: `a - b`
- Multiplication: `a * b`
- Division: `a / b`
- Modulus: `a % b`
- Comparison Operators:
- Equal: `a == b`
- Not Equal: `a != b`
- Greater Than: `a > b`
- Less Than: `a < b`
- Greater Than or Equal: `a >= b`
- Less Than or Equal: `a <= b`
- Logical Operators:
- And: `a && b`
- Or: `a || b`
- Not: `!a`
Functions
- Functions: Reusable blocks of code that take arguments and return values.
- Function Declaration: `function functionName(parameters) { code }`
- Function Call: `functionName(arguments)`
Variables
- Variables: Named storage locations that hold values.
- Variable Declaration: `let`, `const`, or `var` keyword followed by the variable name and
assignment operator (`=`).
- Variable Assignment: Assigning a value to a variable using the assignment operator (`=`).
- Variable Scope: The region of the code where the variable is defined and accessible.
These are the basic building blocks of programming. Mastering these concepts will provide a
solid foundation for learning more advanced programming topics.