This repository contains a comprehensive collection of JavaScript concepts, examples, and projects covering fundamental to advanced topics. Perfect for beginners to advanced developers looking to master JavaScript.
- Variables and Data Types
- Arrays and Objects
- Functions and Scope
- Logic and Control Flow
- Iteration and Array Methods
- DOM Manipulation
- Events
- Projects
- Asynchronous JavaScript
- Fetch API and Async/Await
- Web Browser APIs
- Object-Oriented Programming
- Modern Classes and OOP (ES2022+)
- Modules and Tooling
- Iterators, Generators, and Data Structures
- Unit Testing and Algorithms
- Node.js Core Modules
- π Detailed explanations with code examples
- π¨ Interactive demos and projects
- π Practical exercises and challenges
- π§ͺ Unit tests for algorithms
- π± Responsive web applications
- π§ Modern JavaScript tools and practices
console.log("Hello World");
console.table({ name: "John", age: 30 });
console.time("Timer");
console.timeEnd("Timer");// Primitive Types
const name = "John"; // String
const age = 30; // Number
const isAdmin = true; // Boolean
const nothing = null; // Null
let undefined; // Undefined
const symbol = Symbol(); // Symbol
const bigInt = 9007199254740991n; // BigInt
// Reference Types
const person = {
// Object
name: "John",
age: 30,
};
const numbers = [1, 2, 3]; // Array
const date = new Date(); // Date- Variables declaration and scope (var, let, const)
- Data types and type conversion
- Stack vs Heap memory allocation
- Operators and type coercion
- String manipulation and template literals
- Numbers and Math object methods
- Modern Date and Time handling
- Array basics and methods
- Nesting, concatenation, and spread operator
- Object literals
- Object methods and properties
- Destructuring and naming conventions
- JSON data handling
// Function Declaration
function add(a, b) {
return a + b;
}
// Function Expression
const multiply = function (a, b) {
return a * b;
};
// Arrow Function
const divide = (a, b) => a / b;
// Method in Object
const calculator = {
subtract(a, b) {
return a - b;
},
};- Global scope vs Function scope
- Block scope with let and const
- Lexical scope and closures
- this context and binding
- Arrow functions and this
- Execution context and call stack
- Function hoisting and TDZ
- If statements and conditions
- Switch statements
- Calculator implementation
- Truthy and falsy values
- Logical operators and assignments
- Ternary operators
- For loops
- While and do-while loops
- FizzBuzz implementation
- ForEach, map, filter, reduce
- Array method challenges
- DOM selectors and properties
- Traversing the DOM
- Creating and modifying elements
- Styling and class manipulation
- Shopping list implementation
- Event listeners
- Mouse and keyboard events
- Event object handling
- Form events
- Event bubbling and delegation
- Window events
- Shopping List Application
- Other mini-projects throughout sections
- setTimeout and setInterval
- Callbacks
- Promises
- Async/Await
- Error handling
- Multiple promises handling
- Geolocation API
- Canvas
- Audio API
- Video Player
- Text-to-Speech
- Animation implementations
- Constructor functions
- Prototypes and inheritance
- Property flags and descriptors
// Basic Class
class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}
greet() {
return `Hello, I'm ${this.name}`;
}
}
// Inheritance
class Employee extends Person {
constructor(name, age, role) {
super(name, age);
this.role = role;
}
}class BankAccount {
// Private field (ES2022+)
#balance = 0;
// Private method
#validateAmount(amount) {
return amount > 0;
}
deposit(amount) {
if (this.#validateAmount(amount)) {
this.#balance += amount;
return true;
}
return false;
}
}class Product {
static #tax = 0.1;
#price;
constructor(price) {
this.#price = price;
}
// Getter
get finalPrice() {
return this.#price * (1 + Product.#tax);
}
// Setter
set price(newPrice) {
if (newPrice >= 0) {
this.#price = newPrice;
}
}
// Static method
static calculateTax(price) {
return price * Product.#tax;
}
}- Class fields (public and private)
- Static members and methods
- Method binding and 'this' context
- Property descriptors and flags
- Object freezing and sealing
- Define Property API
- NPM package manager
- Node.js modules
- ES Modules
- Module bundlers
- Webpack basics
- Symbols
- Iterators and Generators
- Sets and Maps
- Stacks and Queues
- Linked Lists
- Jest testing framework
- Common algorithm implementations
- Test-driven development practices
- File System (fs)
- Path
- Operating System (os)
- URL and QueryString
- HTTP module
- Clone this repository
git clone https://github.com/yourusername/javascript-learning.git- Navigate to project directory
cd javascript-learning- Install dependencies (for sections requiring npm)
npm install- Open
index.htmlfiles in your browser or use Live Server
- Basic understanding of HTML and CSS
- Modern web browser
- Text editor (VS Code recommended)
- Node.js (v14+ recommended)
- npm (comes with Node.js)
- Live Server
- JavaScript (ES6) code snippets
- ESLint
- Prettier
- Debug for Chrome
- ESLint for code linting
- Prettier for code formatting
- Jest for unit testing
- Fork the repository
- Create your feature branch
git checkout -b feature/AmazingFeature- Commit your changes
git commit -m 'Add some AmazingFeature'- Push to the branch
git push origin feature/AmazingFeature- Open a Pull Request
This project is open source and available under the MIT License.
- MDN Web Docs
- JavaScript.info
- Modern JavaScript Tutorial
- Various open source contributors
Project Link: https://github.com/nilanshukumarsingh/javascript-learning
βοΈ Star this repository if you find it helpful!