Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

Β 

History

67 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Vanilla JavaScript Learning Repository

A comprehensive, professional, and educational Vanilla JavaScript codebase that demonstrates ALL core and advanced JavaScript concepts. Perfect for beginners learning JavaScript and developers preparing for technical interviews.

πŸ“‹ Table of Contents

🎯 Overview

This repository is a complete learning resource for Vanilla JavaScript. Every major JavaScript topic is implemented with:

  • βœ… Clear, detailed comments
  • βœ… 2-3 real-world examples per topic
  • βœ… Console output demonstrations
  • βœ… DOM usage where applicable
  • βœ… Best practices and modern ES6+ syntax
  • βœ… Beginner-friendly but interview-ready code

No frameworks, no libraries - Pure Vanilla JavaScript!

πŸ“ Project Structure

vanilla-javascript/
β”‚
β”œβ”€β”€ index.html              # Main navigation and UI
β”œβ”€β”€ README.md              # This file
β”œβ”€β”€ assets/
β”‚   └── styles.css         # Global styles
β”‚
β”œβ”€β”€ basics/                # Fundamental concepts
β”‚   β”œβ”€β”€ variables.js
β”‚   β”œβ”€β”€ data-types.js
β”‚   β”œβ”€β”€ operators.js
β”‚   └── type-coercion.js
β”‚
β”œβ”€β”€ control-flow/          # Conditional logic and loops
β”‚   β”œβ”€β”€ if-else.js
β”‚   β”œβ”€β”€ switch.js
β”‚   └── loops.js
β”‚
β”œβ”€β”€ functions/             # Function types and patterns
β”‚   β”œβ”€β”€ function-types.js
β”‚   β”œβ”€β”€ parameters-vs-arguments.js
β”‚   β”œβ”€β”€ arrow-functions.js
β”‚   β”œβ”€β”€ iife.js
β”‚   └── higher-order-functions.js
β”‚
β”œβ”€β”€ scope/                 # Scope and closures
β”‚   β”œβ”€β”€ scope-types.js
β”‚   β”œβ”€β”€ closures.js
β”‚   └── this-keyword.js
β”‚
β”œβ”€β”€ objects/               # Object manipulation
β”‚   β”œβ”€β”€ object-basics.js
β”‚   β”œβ”€β”€ object-methods.js
β”‚   β”œβ”€β”€ destructuring.js
β”‚   └── copy-vs-reference.js
β”‚
β”œβ”€β”€ arrays/                # Array methods and operations
β”‚   β”œβ”€β”€ array-methods.js
β”‚   β”œβ”€β”€ map-filter-reduce.js
β”‚   β”œβ”€β”€ find-sort.js
β”‚   └── destructuring.js
β”‚
β”œβ”€β”€ strings/               # String manipulation
β”‚   β”œβ”€β”€ string-methods.js
β”‚   └── template-literals.js
β”‚
β”œβ”€β”€ dom/                   # DOM manipulation
β”‚   β”œβ”€β”€ selectors.js
β”‚   β”œβ”€β”€ dom-manipulation.js
β”‚   β”œβ”€β”€ create-elements.js
β”‚   └── forms.js
β”‚
β”œβ”€β”€ events/                # Event handling
β”‚   β”œβ”€β”€ event-basics.js
β”‚   β”œβ”€β”€ event-delegation.js
β”‚   └── bubbling-capturing.js
β”‚
β”œβ”€β”€ async/                 # Asynchronous JavaScript
β”‚   β”œβ”€β”€ callbacks.js
β”‚   β”œβ”€β”€ promises.js
β”‚   β”œβ”€β”€ async-await.js
β”‚   └── timers.js
β”‚
β”œβ”€β”€ api/                   # Fetch API
β”‚   β”œβ”€β”€ fetch-get.js
β”‚   β”œβ”€β”€ fetch-post.js
β”‚   └── error-handling.js
β”‚
β”œβ”€β”€ browser/               # Browser APIs
β”‚   β”œβ”€β”€ local-storage.js
β”‚   β”œβ”€β”€ session-storage.js
β”‚   β”œβ”€β”€ cookies.js
β”‚   └── navigator-location.js
β”‚
β”œβ”€β”€ error-handling/         # Error management
β”‚   └── try-catch.js
β”‚
β”œβ”€β”€ modules/               # ES6 Modules
β”‚   β”œβ”€β”€ math.js
β”‚   └── main.js
β”‚
β”œβ”€β”€ advanced/              # Advanced topics
β”‚   β”œβ”€β”€ hoisting.js
β”‚   β”œβ”€β”€ prototype.js
β”‚   β”œβ”€β”€ classes.js
β”‚   β”œβ”€β”€ inheritance.js
β”‚   β”œβ”€β”€ debouncing.js
β”‚   └── throttling.js
β”‚
└── mini-projects/         # Practical projects
    β”œβ”€β”€ todo-app/
    β”œβ”€β”€ counter/
    └── modal/

πŸš€ Getting Started

Prerequisites

  • A modern web browser (Chrome, Firefox, Safari, Edge)
  • A local web server (optional, but recommended)

Running the Project

  1. Clone or download this repository

    git clone https://github.com/yourusername/vanilla-javascript.git
    cd vanilla-javascript
  2. Open in browser

    • Simply open index.html in your browser, OR

    • Use a local server:

      # Python 3
      python -m http.server 8000
      
      # Node.js (with http-server)
      npx http-server
      
      # VS Code Live Server extension
      # Right-click index.html β†’ Open with Live Server
  3. Navigate and Learn

    • Click any button in the navigation to load and run examples
    • Check the browser console for output
    • View DOM output in the main area

πŸ“š Learning Path

Beginner Level (Start Here!)

  1. Basics

    • Variables (basics/variables.js)
    • Data Types (basics/data-types.js)
    • Operators (basics/operators.js)
    • Type Coercion (basics/type-coercion.js)
  2. Control Flow

    • If/Else (control-flow/if-else.js)
    • Switch (control-flow/switch.js)
    • Loops (control-flow/loops.js)
  3. Functions

    • Function Types (functions/function-types.js)
    • Arrow Functions (functions/arrow-functions.js)
  4. Arrays & Objects

    • Array Methods (arrays/array-methods.js)
    • Object Basics (objects/object-basics.js)
  5. DOM Basics

    • Selectors (dom/selectors.js)
    • DOM Manipulation (dom/dom-manipulation.js)

Intermediate Level

  1. Advanced Functions

    • Closures (scope/closures.js)
    • Higher-Order Functions (functions/higher-order-functions.js)
    • IIFE (functions/iife.js)
  2. Scope & Context

    • Scope Types (scope/scope-types.js)
    • This Keyword (scope/this-keyword.js)
  3. Array Operations

    • Map, Filter, Reduce (arrays/map-filter-reduce.js)
    • Find & Sort (arrays/find-sort.js)
  4. Events

    • Event Basics (events/event-basics.js)
    • Event Delegation (events/event-delegation.js)
  5. Async Basics

    • Callbacks (async/callbacks.js)
    • Promises (async/promises.js)

Advanced Level

  1. Async/Await

    • Async/Await (async/async-await.js)
    • Timers (async/timers.js)
  2. APIs

    • Fetch GET (api/fetch-get.js)
    • Fetch POST (api/fetch-post.js)
    • Error Handling (api/error-handling.js)
  3. Advanced Concepts

    • Prototypes (advanced/prototype.js)
    • Classes (advanced/classes.js)
    • Inheritance (advanced/inheritance.js)
    • Hoisting (advanced/hoisting.js)
  4. Performance

    • Debouncing (advanced/debouncing.js)
    • Throttling (advanced/throttling.js)
  5. Modules

    • ES6 Modules (modules/main.js)

πŸ“– Topics Covered

Core Concepts

  • βœ… Variables (var, let, const)
  • βœ… Data Types (Primitives & Objects)
  • βœ… Operators (Arithmetic, Logical, Comparison)
  • βœ… Type Coercion & Truthy/Falsy
  • βœ… Control Flow (if/else, switch, loops)
  • βœ… Functions (All types)
  • βœ… Scope & Closures
  • βœ… This Keyword
  • βœ… Hoisting

Data Structures

  • βœ… Objects (Creation, Methods, Destructuring)
  • βœ… Arrays (Methods, Map/Filter/Reduce)
  • βœ… Strings (Methods, Template Literals)
  • βœ… Copy vs Reference

DOM & Events

  • βœ… DOM Selectors
  • βœ… DOM Manipulation
  • βœ… Creating Elements
  • βœ… Form Handling
  • βœ… Event Listeners
  • βœ… Event Delegation
  • βœ… Bubbling & Capturing

Asynchronous JavaScript

  • βœ… Callbacks
  • βœ… Promises
  • βœ… Async/Await
  • βœ… Timers (setTimeout, setInterval)

Browser APIs

  • βœ… Fetch API (GET, POST, Error Handling)
  • βœ… Local Storage
  • βœ… Session Storage
  • βœ… Cookies
  • βœ… Navigator & Location

Advanced Topics

  • βœ… Prototypes & Inheritance
  • βœ… ES6 Classes
  • βœ… ES6 Modules
  • βœ… Error Handling
  • βœ… Debouncing & Throttling

🎨 Mini Projects

Three complete, functional projects demonstrating real-world JavaScript:

1. Todo App (mini-projects/todo-app/)

  • Add, toggle, and delete todos
  • Local storage persistence
  • Clean, modern UI

2. Counter App (mini-projects/counter/)

  • Increment, decrement, reset
  • History tracking
  • Local storage

3. Modal Component (mini-projects/modal/)

  • Multiple modal types
  • Click outside to close
  • Keyboard support (Escape key)
  • Smooth animations

πŸ’‘ Interview Tips

Common JavaScript Interview Questions Covered

  1. Closures

    • See scope/closures.js for examples
    • Understand lexical scope and closure patterns
  2. This Keyword

    • See scope/this-keyword.js
    • Know call, apply, bind
  3. Hoisting

    • See advanced/hoisting.js
    • Understand var vs let/const hoisting
  4. Prototypes & Inheritance

    • See advanced/prototype.js and advanced/inheritance.js
    • Know prototype chain
  5. Event Delegation

    • See events/event-delegation.js
    • Understand performance benefits
  6. Promises & Async/Await

    • See async/promises.js and async/async-await.js
    • Know Promise.all(), Promise.race()
  7. Map, Filter, Reduce

    • See arrays/map-filter-reduce.js
    • Essential for functional programming questions
  8. Debouncing & Throttling

    • See advanced/debouncing.js and advanced/throttling.js
    • Common performance optimization questions

Practice Problems

Try implementing these using the concepts in this repo:

  1. Reverse a string (using string methods)
  2. Find duplicates in array (using array methods)
  3. Implement debounce function (see advanced/debouncing.js)
  4. Flatten nested array (using reduce)
  5. Deep clone object (see objects/copy-vs-reference.js)
  6. Implement Promise.all (see async/promises.js)

✨ Best Practices

This repository follows JavaScript best practices:

  1. Use const and let - Avoid var
  2. Arrow Functions - For cleaner syntax
  3. Template Literals - Instead of string concatenation
  4. Destructuring - For cleaner code
  5. Async/Await - Over callbacks when possible
  6. Error Handling - Always use try/catch
  7. Meaningful Names - Clear variable and function names
  8. Comments - Explain complex logic
  9. ES6+ Features - Modern JavaScript syntax
  10. No Global Pollution - Use modules and IIFE

🀝 Contributing

Contributions are welcome! Feel free to:

  • Add more examples
  • Improve documentation
  • Fix bugs
  • Add more mini projects

πŸ“ License

This project is open source and available for educational purposes.

πŸŽ“ Learning Resources

πŸ™ Acknowledgments

This repository is designed to be a comprehensive learning resource for JavaScript developers at all levels.


Happy Learning! πŸš€

Remember: The best way to learn is by doing. Try modifying the examples and building your own projects!

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages