Welcome to the JavaScript Questions Repository! Below is a step-by-step guide to JavaScript and ECMAScript features. Whether you are a full beginner or an experienced developer, you will be provided with helpful information and practical examples to enhance your JavaScript skills.
This repository contains a set of learning files about JavaScript and different features of ECMAScript. Each file is in Markdown format, with a clear explanation of the concepts and features alongside useful examples. The originals have been taken from w3schools.com, I have reorganized it and added further explanation to those topics. Also, all contents have been translated into Persian (Farsi) and added to this repository to make it more convenient for usage.
برای دسترسی به محتوای فارسی، به فایل README-FA.md مراجعه کنید.
- Basic Topics: Covers foundational JavaScript concepts like data types, variables, operators, conditionals, and loops.
- Intermediate Topics: Delves into functions, arrays, objects, error handling, callbacks, promises, DOM, and BOM.
- Advanced Topics: Explores OOP, memory management, advanced array and string methods, async/await, and module management.
- ES5 - 2009: Introduces "use strict", new methods for strings and arrays, and JSON handling.
- ES6 - 2015: Features `let`, `const`, arrow functions, destructuring, classes, promises, and more.
- ES7 - 2016: Adds exponentiation operators and the `includes` method for arrays.
- ES8 - 2017: Introduces string padding, object methods, async/await, and trailing commas.
- ES9 - 2018: Focuses on asynchronous iteration, new promise methods, object rest properties, and regex enhancements.
- ES10 - 2019: Adds `trimStart`, `trimEnd`, `Object.fromEntries`, flat and flatMap methods, and optional catch binding.
- ES11 - 2020: Introduces BigInt, `matchAll`, nullish coalescing, and optional chaining.
- ES12 - 2021: Adds `Promise.any`, `replaceAll`, and numeric separators.
- ES13 - 2022: Features `at` methods for arrays and strings, the `d` flag in regex, and `Object.hasOwn`.
- ES14 - 2023: Introduces `findLast`, `findLastIndex`, and safe array methods.
- ES15 - 2024: Covers new grouping methods and Temporal API features.
- Introduction to JavaScript
- Data Types and Variables
- Operators and Expressions
- Conditional Structures
- Loops
- Functions and Variable Scope
- Working with Arrays and Objects
- Error Handling
- Understanding Callbacks and Promises
- Introduction to DOM and BOM
- Object-Oriented Programming
- Memory Management and Optimization
- Advanced Methods for Arrays and Strings
- Using `async/await`
- Concepts of Modularity and Module Management
- "use strict" and its advantages: Enforce stricter parsing and error handling in JavaScript.
- Accessing string characters using indexes: Work with string characters like arrays.
- Multi-line strings: Handle strings that span multiple lines.
- Using reserved words as property names: Use reserved words as object property names safely.
- String.trim Method: Remove whitespace from both ends of a string.
- Array.isArray Method: Check if a value is an array.
- Array.forEach Method: Execute a function on each array element.
- Array.map Method: Create a new array with the results of calling a function on every array element.
- Array.filter Method: Create a new array with elements that pass a test.
- Array.reduce Method: Reduces array to a single value.
- Array.reduceRight Method: Similar to reduce, but starts from the last element.
- Array.every Method: Checks if all elements pass a test.
- Array.some Method: Checks if any element passes a test.
- Array.indexOf Method: Returns the first index of a specified element.
- Array.lastIndexOf Method: Returns the last index of a specified element.
- JSON.parse Method: Converts JSON string to JavaScript object.
- JSON.stringify Method: Converts JavaScript object to JSON string.
- Date.now Method: Returns the current timestamp.
- Date.toISOString Method: Converts date to ISO format string.
- Date.toJSON Method: Converts date to JSON format.
- Using Getters and Setters: Control access to object properties.
- Object.defineProperty Method: Define a new property directly on an object.
- Object.create Method: Create a new object with a specified prototype object and properties.
- Object.keys Method: Return an array of a given object's own property names.
- Function.bind Method: Create a new function that, when called, has its `this` keyword set to the provided value.
- Trailing Commas: Use commas at the end of objects or arrays.
- let Keyword in JavaScript: Declares block-scoped variables that can be reassigned.
- const Keyword in JavaScript: Declares block-scoped constants that cannot be reassigned.
- Arrow Functions: Provide a concise syntax for writing functions.
- Object Destructuring: Extracts properties from objects into variables.
- Array Destructuring: Extracts elements from arrays into variables.
- Spread Operator: Expand elements in an iterable.
- For/of Loop: Iterate over iterable objects.
- Map Object: Hold key-value pairs and remember the original insertion order.
- Set Object: Store unique values of any type.
- Classes and Their Usage: Provide a blueprint for creating objects.
- Promises: Handle asynchronous operations.
- Symbol Data Type: Create unique identifiers.
- Default Parameters in Functions: Set default values for function parameters.
- Rest Parameter in Functions: Represent an indefinite number of arguments as an array.
- String.includes Method: Check if a string contains a substring.
- String.startsWith Method: Checks if a string begins with a specified substring.
- String.endsWith Method: Checks if a string ends with a specified substring.
- Array.entries Method: Returns an iterator with key/value pairs for each array element.
- Array.from Method: Creates a new array from an iterable or array-like object.
- Array.keys Method: Returns an iterator for the keys (indexes) of an array.
- Array.find Method: Returns the first element that matches a condition.
- Array.findIndex Method: Returns the index of the first element that matches a condition.
- New Math Methods: Perform mathematical operations.
- New Number Features: Work with numbers more effectively.
- New Global Methods: New methods added to global objects.
- Modules in JavaScript: Reuse code by importing and exporting modules.
- Exponentiation Operator (**): Perform exponentiation more concisely.
- Exponentiation Assignment Operator (**=): Assign results of exponentiation to variables directly.
- Array.includes Method: Check if an array contains a specific element.
- String Padding (padStart and padEnd): Pad strings to a specific length.
- Object.entries and Object.values Methods: Convert objects to arrays of key-value pairs or values.
- Async/await Syntax: Write asynchronous code more comfortably.
- Trailing Commas in Functions: Make function parameters lists more manageable.
- Object.getOwnPropertyDescriptors Method: Get all property descriptors of an object.
- Asynchronous Iteration Loop: Iterate over asynchronous data sources.
- Promise.prototype.finally Method: Execute a callback when a promise is settled, regardless of the outcome.
- Object Rest Properties: Extract parts of an object while keeping the rest.
- New RegExp Features: Enhance regular expressions with new capabilities.
- Shared Memory in JavaScript: Share data between threads or web workers safely.
- String.prototype.trimStart and trimEnd Methods: Remove whitespace from the start or end of a string.
- Object.fromEntries Method: Convert an array of key-value pairs into an object.
- Optional Catch Binding: Simplify error handling by omitting the error parameter.
- Array.flat and Array.flatMap Methods: Flatten nested arrays.
- Revised Array.sort Feature: Ensure stable sorting of arrays.
- Revised JSON.stringify Feature: Always produce valid Unicode strings.
- Use of Separators in String Literals: Make JSON a full superset of ECMAScript.
- Revised Function.prototype.toString Method: Return exact source code text.
- BigInt: Handle large integers safely without losing precision.
- String.prototype.matchAll Method: Find all matches of a regex in a string.
- Nullish Coalescing Operator (??): Provide a default value only for `null` or `undefined`.
- Optional Chaining Operator (?.): Access properties deeply without worrying about `undefined` errors.
- Logical AND Assignment Operator (&&=): Assign a value to a variable only if it is `true`.
- Logical OR Assignment Operator (||=): Assign a value to a variable only if it is `false`, `null`, or `undefined`.
- Nullish Coalescing Assignment Operator (??=): Assign a value to a variable only if it is `null` or `undefined`.
- Promise.allSettled Method: Wait for all promises to complete and handle all outcomes.
- Dynamic Import Feature: Load modules only when needed.
- Promise.any Method: Get the first successfully resolved promise out of several.
- replaceAll Method: Replace all occurrences of a word or phrase in a string.
- Numeric Separators (_): Improve the readability of large numbers.
- Array.at Method: Accesses an element in an array using a positive or negative index.
- String.at Method: Accesses a character in a string using a positive or negative index.
- d Flag in RegExp: Provide exact start and end positions of matches.
- Object.hasOwn Method: Safely check if an object has a specific property.
- error.cause Feature: Attach detailed information about error causes.
- await import Feature: Dynamically import modules using `await`.
- Class Field Declarations: Declare class variables directly inside the class.
- Private Methods and Fields in Classes: Protect internal code from outside access.
- Array.findLast Method: Find the last element that matches a condition.
- Array.findLastIndex Method: Find the index of the last element that matches a condition.
- Array.toReversed Method: Return a reversed copy of the array without modifying the original.
- Array.toSorted Method: Return a sorted copy of the array without modifying the original.
- Array.toSpliced Method: Return a modified copy of the array without altering the original.
- Array.with Method: Return a new array with specified elements replaced.
- #! (Shebang) Feature: Specify the interpreter to execute a script file in Unix/Linux environments.
- Object.groupBy Method: Group elements of an array of objects based on a callback function result.
- Map.groupBy Method: Similar to `Object.groupBy` but returns a `Map` for more flexibility in key types.
- Temporal.PlainDate Feature: Manage dates without time-of-day information, perfect for calendar calculations.
- Temporal.PlainTime Feature: Handle time without dates, ideal for representing times in a day with precision.
- Temporal.PlainMonthDay Feature: Manage recurring dates like birthdays and anniversaries without associating a year.
- Temporal.PlainYearMonth Feature: Manage year-month combinations, useful for financial dates and monthly reporting.