Skip to content

kj5699/javascript-playground

Repository files navigation

JavaScript Interview Preparation Playground

A comprehensive collection of JavaScript interview questions and their implementations, organized by categories and difficulty levels.

πŸ“š Overview

This repository contains 40+ commonly asked JavaScript interview questions with working implementations. Perfect for preparing for frontend developer positions at companies like Google, Amazon, Microsoft, and startups.

🎯 What's Inside

πŸ“– QUESTIONNAIRE.md - Complete Question Bank

A comprehensive guide with:

  • Detailed problem statements
  • Key concepts for each question
  • Difficulty ratings
  • Category-wise organization
  • Quick reference guide

πŸ“ Repository Structure

javascript-playground/
β”œβ”€β”€ async-patterns/          # Async programming challenges
β”‚   β”œβ”€β”€ asyncSequence.js     # Parallel vs Series execution
β”‚   β”œβ”€β”€ FetchWithLimit.js    # Rate-limited API calls
β”‚   β”œβ”€β”€ mapLimit.js          # Concurrent async operations
β”‚   └── PromiseSchedulor.js  # Promise orchestration with pause/resume
β”‚
β”œβ”€β”€ patterns/                # Design Patterns
β”‚   β”œβ”€β”€ circuitBreaker.js    # Circuit Breaker pattern
β”‚   β”œβ”€β”€ singleton.js         # Singleton implementation
β”‚   β”œβ”€β”€ pub-sub.js          # Event Emitter/Observer
β”‚   β”œβ”€β”€ proxy.js            # Proxy pattern
β”‚   └── resourcePool.js     # Resource pooling
β”‚
β”œβ”€β”€ utilities/              # Utility implementations
β”‚   β”œβ”€β”€ currencyConverter.js # Graph-based currency conversion
β”‚   β”œβ”€β”€ customCookie.js      # Custom cookie handler
β”‚   β”œβ”€β”€ customSetTimeout.js  # setTimeout implementation
β”‚   β”œβ”€β”€ mutationObserver.js  # DOM observation
β”‚   └── pipe.js             # Function composition
β”‚
β”œβ”€β”€ polyfills/              # JavaScript polyfills
β”‚   └── index.js            # Promise, map, reduce, call, bind, etc.
β”‚
β”œβ”€β”€ lld/                    # Low-Level Design
β”‚   β”œβ”€β”€ fileSystem.js       # In-memory file system
β”‚   └── orderManagement.js  # E-commerce order system
β”‚
β”œβ”€β”€ interview-questions/    # Company-specific questions
β”‚   β”œβ”€β”€ rateLimiter.js      # API rate limiting
β”‚   β”œβ”€β”€ middleware-thoughtspot.js # Middleware pattern
β”‚   β”œβ”€β”€ tekion.js           # Tekion interview problems
β”‚   └── tekion2.js
β”‚
β”œβ”€β”€ debounce-throttle/      # Performance optimization
β”‚   └── index.js            # Debounce & Throttle
β”‚
β”œβ”€β”€ promises/               # Promise deep dive
β”‚   β”œβ”€β”€ CustomPromise.js    # Full Promise implementation
β”‚   └── index.js            # Promise concepts & examples
β”‚
β”œβ”€β”€ outputs/                # Output-based questions
β”‚   └── index.js            # Event loop, closures, etc.
β”‚
β”œβ”€β”€ this/                   # 'this' keyword concepts
β”‚   └── index.js            # All 'this' binding scenarios
β”‚
β”œβ”€β”€ dom/                    # DOM manipulation
β”‚   └── index.js            # DOM APIs
β”‚
β”œβ”€β”€ system-design/          # System design concepts
β”‚   └── normalization/      # State normalization
β”‚
└── typescript/             # TypeScript examples
    └── src/

πŸš€ Getting Started

Prerequisites

  • Node.js (v14+)
  • Modern web browser (for DOM examples)

Running Examples

  1. Node.js examples:
node async-patterns/PromiseSchedulor.js
node patterns/circuitBreaker.js
  1. Browser examples:
# Open HTML files in browser
open debounce-throttle/index.html
open promises/index.html

πŸ“Š Question Categories

πŸ”„ Async Patterns (5 questions)

  • Promise scheduling with pause/resume
  • Rate-limited fetch
  • Concurrent operation limiting
  • Series vs Parallel execution

🎨 Design Patterns (5 questions)

  • Circuit Breaker
  • Singleton
  • Pub-Sub (Event Emitter)
  • Proxy
  • Resource Pool

πŸ”§ Polyfills (10+ questions)

  • Promise, Promise.all, Promise.allSettled
  • call, bind, apply
  • map, reduce, forEach, flat
  • Object.flatten

πŸ—οΈ Low-Level Design (4 questions)

  • File System
  • Order Management System
  • Rate Limiter
  • Middleware System

πŸ’» Output-Based (6+ questions)

  • Event loop & execution order
  • Closures & scope
  • Promise chains
  • Array.map with parseInt
  • setTimeout in loops

πŸ“˜ Concepts (3 topics)

  • this keyword (all scenarios)
  • Promises (deep dive)
  • DOM manipulation

πŸŽ“ Difficulty Levels

⭐ Easy (Good for Beginners)

  • Debounce/Throttle
  • Array polyfills
  • DOM manipulation
  • Basic Promise usage
  • Singleton pattern

⭐⭐ Medium (Common Interview Questions)

  • Custom Promise implementation
  • Circuit Breaker
  • Rate Limiter
  • mapLimit
  • Curry/Compose
  • Pub-Sub pattern

⭐⭐⭐ Hard (Senior Level)

  • Promise Scheduler with pause/resume
  • Resource Pool
  • File System Design
  • Currency Converter with graph traversal
  • Middleware implementation

πŸ“ How to Use This Repository

For Interview Prep:

  1. Read QUESTIONNAIRE.md for problem statements
  2. Try solving without looking at code
  3. Compare your solution with implementation
  4. Understand the key concepts

For Quick Revision:

  1. Use QUESTIONNAIRE.md as a checklist
  2. Review output-based questions
  3. Practice explaining concepts

For Deep Learning:

  1. Read and understand each implementation
  2. Run the code and see outputs
  3. Modify code to test edge cases
  4. Add your own test cases

🎯 Interview Tips

What Interviewers Look For:

  • Problem-solving approach: Think out loud
  • Code quality: Clean, readable code
  • Edge cases: Consider boundary conditions
  • Time/Space complexity: Analyze your solution
  • Communication: Explain your thought process

Common Topics:

  • βœ… Promises & Async/Await
  • βœ… Closures & Scope
  • βœ… Event Loop & Execution Context
  • βœ… Array/Object methods
  • βœ… this keyword
  • βœ… Design Patterns
  • βœ… Performance Optimization
  • βœ… System Design basics

πŸ“š Key Concepts Covered

JavaScript Fundamentals

  • Execution Context
  • Hoisting
  • Closures
  • Prototypes
  • this binding

Async JavaScript

  • Promises
  • Async/Await
  • Event Loop
  • Microtasks vs Macrotasks
  • Concurrent execution

Design Patterns

  • Singleton
  • Observer (Pub-Sub)
  • Circuit Breaker
  • Proxy
  • Factory

Data Structures & Algorithms

  • Graphs (Currency Converter)
  • Trees (File System)
  • Queues (Rate Limiter, Middleware)
  • BFS/DFS

Performance

  • Debouncing
  • Throttling
  • Memoization
  • Resource Pooling

🏒 Company-Specific Questions

This repository includes actual questions asked at:

  • Tekion
  • Thoughtspot
  • And other top companies

πŸ”— Related Topics Not Covered

This is a JavaScript-focused repository. For complete interview prep, also study:

  • React/Vue/Angular (if required)
  • TypeScript
  • Testing (Jest, Testing Library)
  • Build tools (Webpack, Vite)
  • Git & Version Control
  • System Design (for senior roles)

πŸ“ˆ Progress Tracking

Use this checklist to track your progress:

Async Patterns:

  • asyncSequence
  • FetchWithLimit
  • mapLimit
  • PromiseSchedulor

Design Patterns:

  • Circuit Breaker
  • Singleton
  • Pub-Sub
  • Proxy
  • Resource Pool

Polyfills:

  • Promise
  • Promise.all/allSettled
  • call/bind/apply
  • map/reduce/forEach
  • Array.flat
  • Object.flatten

LLD:

  • File System
  • Order Management
  • Rate Limiter
  • Middleware

Concepts:

  • this keyword
  • Promises
  • Event Loop
  • Closures

🀝 Contributing

Feel free to:

  • Add more questions
  • Improve implementations
  • Fix bugs
  • Add test cases
  • Improve documentation

πŸ“„ License

This repository is for educational purposes. Feel free to use for interview preparation.


🌟 Star this repo if it helped you!

Good luck with your interviews! πŸš€

Pro Tip: Don't just memorize solutions. Understand the concepts and practice explaining them in simple terms.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors