Skip to Content
Getting started

Advanced JavaScript Code Snippets

Getting Started

💡 Leetcode problems can sometimes feel disconnected from real-world development ( with a few valuable exceptions: graph algorithms and system design ).

What truly matters? Understanding how JavaScript works under the hood. If you don’t understand JavaScript, Leetcode is just a waste of time — you’re solving abstract puzzles without mastering the real engine behind your code. Instead, build your skills with Advanced JavaScript Patterns, carefully selected code snippets, and concepts that companies actually expect in interviews.

Dive in, practice, and develop real confidence.

📌 This resource complements foundational learning platforms like MDN Web Docs, JavaScript.info, and react.dev. If you’re just starting out, begin there to build strong fundamentals. If you’re more experienced, use Advanced JavaScript Code Snippets to reinforce concepts, explore edge cases, and reference patterns that work in practice.

🧭 Graph Algorithms

Fundamental graph traversal logic used in system design and coding challenges.

  • Graph TraversalBFS, DFS, adjacency lists, graph algorithms.

📦 JS Native

Deep dive into native JavaScript methods and behavior. Each section includes polyfills ( custom implementation ), explanations and all possible use cases.

  • Map – Map, WeakMap, Map.groupBy.
  • Mutating Methods – concat, fill, pop, push, reverse, shift, unshift, splice.
  • Promises – Promise.all, race, any, allSettled.
  • Read methods – at, every, find, findIndex, findLast, includes, indexOf, some.
  • Set and Object – Set, Object.groupBy, Object.assign, Array.entries.
  • Transform Methods – filter, flat, flatMap, join, map, reduce, slice.

📖 Learn JS and Mdn

Essential learning topics pulled from MDN, Learn JS, interviews and my web dev job.

  • Advanced Patterns – Memoize, Mixins, Promise Chaining, Promise Error Handling, Synchronous vs Asynchronous Errors in Promises, Proxy, Range Iterator, Shooters: Closures & Lexical Scope.
  • Delay, Throttling and Debounce – Delay Decorator, Delaying function execution, Output Every Second, setInterval, setTimeout, throttling and debounce decorator.
  • Core Concepts – Understanding this, Loop Behavior: Pre- / Post-Increment, Object and Map Conversion, bind, Async Generators, Fibonacci ( Iterative Approach, Recursive Approach ).
  • Event Loop – Event Loop edge cases — the #1 most asked JavaScript interview topic.
  • This and Object Methods – Nuances of this across different method contexts — the #2 most asked JavaScript interview topic.

⚙️ Lodash

Utility functions from lodash.

  • Chunk, Compact, Partition – chunk, compact, partition.
  • Difference, Intersection, Union – difference, differenceBy, intersection, union.
  • Object Utilities – keyBy, omit, orderBy, pick, curry.

⚛️ React

React specific topics.

  • React Rendering – usePrevious, children.
  • State Patterns – Normalized State, useReducer ( custom implementation ).

🧩 System Design

System design concepts often seen in real interviews.

  • Redux and Twitter – Redux reducer pattern, most used pattern for state management in react. Twitter feed pattern.
  • Queue and Stack – Stacks and queues are core to how JavaScript works under the hood — and they show up in nearly every interview.

🧠 Theory

High-level principles and mental models.

  • Composition vs Inheritance - Composition, Inheritance and Function Stack.
  • SOLID in React - SOLID principles in React.
  • Type Conversions - Explore the magic behind JavaScript type coercion and equality checks.

🔧 Utils

Advanced utility functions and transformation logic — real-world inspired.

  • Call, bind, apply – Understanding call, bind, and apply is essential for mastering how JavaScript handles function context (this). Often asked on interviews.
  • Dictionary of Nested – Deeply nested array structure (e.g., categories → subcategories → items) into a dictionary format for constant-time lookup by id.
  • Group List by Quarters – Groups monthly financial data by calendar quarters.
  • Transform Lists and Trees – List to tree, tree to list, flat nested items.
  • Promises Closures Event Loop – Async behavior, state retention, and timing execution in complex JavaScript code.
  • Sorting – bubble sort, insertion sort, selection sort.
  • Various Utilities – clsx, contains duplicate, deep clone, filter by related property, filterMap, innerJoin, Reducer pattern with actions, Retry with exponential backoff, Shuffle (Fisher-Yates Algorithm), Topological Sort.

About Me

I’m a frontend developer based in Russia, currently working at Sellego. I specialize in building modern web apps using React on the frontend and Node.js on the backend.

Github

Contacts

Last updated on