javascript-mastery

Explains 33 core JavaScript concepts with code examples covering closures, async patterns, and prototypes.

1|Updated Aug 17, 2025
One-click install
npx skills add https://github.com/ratnesh-maurya/mdconverter --skill javascript-mastery-ratnesh-maurya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: javascript-mastery
Source: https://github.com/ratnesh-maurya/mdconverter/tree/main/.claude/skills/javascript-mastery
Command: npx skills add https://github.com/ratnesh-maurya/mdconverter --skill javascript-mastery-ratnesh-maurya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers often struggle with JavaScript's tricky behaviors like type coercion, hoisting, the event loop, and the this keyword, leading to subtle bugs and confusing debugging sessions. This Skill provides a structured reference of 33+ essential JavaScript concepts with runnable code examples to explain, debug, and teach the language. ## Core Features & Use Cases - Fundamentals Reference: Covers primitives, type coercion, equality operators, scope, closures, and var/let/const differences with concrete examples. - Async & Event Loop Guidance: Explains call stack, microtasks vs macrotasks, callbacks, Promises, and async/await patterns including parallel execution. - Functional & Object Patterns: Documents higher-order functions, currying, composition, prototypal inheritance, and modern ES6+ syntax like destructuring and optional chaining. - Use Case: When a developer asks why Promise.resolve().then() logs before setTimeout(..., 0), use this Skill to explain the microtask queue with a clear code demonstration. ## Quick Start Explain why '5' + 3 equals '53' but '5' - 3 equals 2 in JavaScript using the type coercion rules.

Frequently Asked Questions about javascript-mastery

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I explain JavaScript closures with examples?

A closure is a function that remembers its lexical scope even after the outer function returns. The classic example is a counter factory where inner methods increment a private `count` variable, demonstrating data privacy and the module pattern.

What is the difference between == and === in JavaScript?

`==` performs type coercion before comparison, so `"5" == 5` is true, while `===` compares without coercion, making `"5" === 5` false. The recommended rule is to always use `===` unless you have a specific reason for loose equality.

Why does Promise.then run before setTimeout with zero delay?

Promise callbacks are microtasks, which the event loop executes immediately after the current synchronous code finishes. setTimeout callbacks are macrotasks, which only run after all microtasks complete, so Promises always win the race.

Does const make JavaScript objects immutable?

No, const only prevents reassignment of the variable binding, not mutation of the object's properties. You can still add or modify properties on a const object; use Object.freeze() to make it truly immutable.

When should I use nullish coalescing instead of logical OR?

Use `??` when you want defaults only for null or undefined, since `||` also treats falsy values like 0 and empty strings as missing. For example, `0 ?? "default"` returns 0, while `0 || "default"` returns "default".