Syntax Cache
BlogMethodFeaturesHow It WorksBuild a Game
  1. Home
  2. JavaScript
JavaScript11 topics350+ exercises

JavaScript Syntax Practice

Stop googling the same JS syntax. Make it automatic.

Short daily reps. Spaced repetition automatically brings back what you keep forgetting.

JavaScript is wide. You can "know JS" and still burn time on the same stuff: - Which Promise helper do I want here? - Why is `this` undefined in my callback? - Why did my effect run twice in dev? - Why did my spread copy still share nested objects?

This is not a tutorial. It's recall practice. You type patterns from memory, the scheduler tracks what you forget, and weak spots come back until they stick. Async, modules, DOM, hooks, TypeScript. The stuff you actually ship.

Popular topics include JavaScript Async/Await Practice, JavaScript Functions Practice, JavaScript Loops Practice.

Built for JavaScript Learners

Great for
  • Frontend and full-stack devs who write JS regularly.
  • Prepping for JavaScript or React interviews.
  • Backend devs picking up frontend or Node.
  • Coming back to JS after a few years away.
You'll be able to
  • Know when to use Promise.all vs allSettled vs race.
  • Pick declaration vs arrow vs expression without thinking.
  • Stop confusing for...of and for...in.
  • Stop accidentally mutating objects when you spread them.
  • Get imports, exports, and TDZ right.
  • Use the DOM without XSS holes or layout thrashing.
  • Write useEffect without stale closures or infinite loops.
  • Use TypeScript to catch bugs, not to silence the compiler.
  • Pass class methods as callbacks without losing `this`.
  • Handle async errors without swallowing or leaking them.
  • Know why `"👍".length` is 2, not 1.

Practice by Topic

Pick a concept and train recall with small, focused reps.

37 exercisesGotchas included

JavaScript Async/Await Practice

Stop mixing up Promise.all vs allSettled and forgetting that forEach won't await.

Show 3 gotchasHide gotchas
  • async functions always return Promises
  • Promise.all fails fast; allSettled waits for everything
  • forEach() doesn't await async callbacks — use for...of instead
Learn more
45 exercisesGotchas included

JavaScript Functions Practice

Know when arrow vs declaration matters — this binding, hoisting, and closure capture.

Show 3 gotchasHide gotchas
  • Arrow functions capture outer this
  • Function declarations hoist; let/const expressions have TDZ
  • Closures capture by reference, not value
Learn more
20 exercisesGotchas included

JavaScript Loops Practice

Stop confusing for...in (keys) vs for...of (values) and reduce on empty arrays.

Show 3 gotchasHide gotchas
  • for...in gives you keys; for...of gives you values
  • forEach can't break and doesn't await callbacks
  • reduce throws on empty arrays without an initial value
Learn more
59 exercisesGotchas included

JavaScript Collections Practice

Know when spread silently shallow-copies and when includes() finds NaN but === doesn't.

Show 3 gotchasHide gotchas
  • Spread is a shallow copy
  • includes() is like ===, but NaN matches NaN
  • Object.keys() returns strings, even for numeric keys
Learn more
19 exercisesGotchas included

JavaScript Modules & Scope Practice

Get TDZ, const mutation, and import hoisting right without trial and error.

Show 3 gotchasHide gotchas
  • let/const/class throw if used before declaration (TDZ)
  • Static import hoists; dynamic import() does not
  • const stops reassignment, not mutation
Learn more
47 exercisesGotchas included

JavaScript DOM Manipulation Practice

Avoid XSS from innerHTML and layout thrashing from interleaved reads and writes.

Show 3 gotchasHide gotchas
  • querySelector can return null
  • innerHTML is an XSS risk; textContent is not
  • Mixing reads and writes causes layout thrashing
Learn more
17 exercisesGotchas included

JavaScript React Hooks Practice

Fix stale closures, infinite re-renders, and Strict Mode double-fire in useEffect.

Show 3 gotchasHide gotchas
  • Strict Mode runs an extra setup+cleanup cycle in dev
  • Missing deps cause stale closures
  • Effects sync with external systems, not internal state
Learn more
50 exercisesGotchas included

TypeScript Practice

Use satisfies over as, unknown over any, and generics to keep real type info.

Show 3 gotchasHide gotchas
  • satisfies checks shape without widening
  • unknown forces narrowing; any disables it
  • Generics keep type info that any loses
Learn more
24 exercisesGotchas included

JavaScript Classes Practice

Stop losing this when passing methods as callbacks and forgetting super() before this.

Show 3 gotchasHide gotchas
  • Passing a method as callback loses this
  • Private # fields cannot be accessed dynamically
  • super() must come before this
Learn more
15 exercisesGotchas included

JavaScript Error Handling Practice

Throw Error objects (not strings), handle unhandled rejections, and know why return await matters in try/catch.

Show 3 gotchasHide gotchas
  • Throw Error objects, not strings
  • Unhandled rejections can terminate the process
  • return await matters inside try/catch
Learn more
17 exercisesGotchas included

JavaScript String Methods Practice

Know why "👍".length is 2, why replace() hits only the first match by default, and when slice beats substring.

Show 3 gotchasHide gotchas
  • .length counts UTF-16 code units, not characters
  • replace() only hits the first match by default
  • slice() supports negative indices; substring() does not
Learn more

JavaScript Cheat Sheets

Copy-ready syntax references for quick lookup

Array MethodsAsync/AwaitES6+ FeaturesDOM ManipulationString MethodsObject MethodsRegex (RegExp)

Sample Exercises

Example 1Difficulty: 1/5

Create a Promise that resolves to "Success".

new Promise(resolve => resolve("Success"))
Example 2Difficulty: 1/5

Define a function `greet` taking `name` as an argument.

function greet(name) {
}

Done Googling JavaScript syntax?

Ten minutes a day. No setup. The syntax sticks.

Why this works

You forget things fastest right after learning them. Spaced repetition quizzes you before you forget, so patterns stick instead of fading.

FAQ

Is this a JavaScript tutorial?

No. This is practice for people who already know JavaScript but want faster recall.

Who is this for?

Working devs, people prepping for interviews, anyone who keeps googling the same syntax.

Do you cover React hooks and TypeScript?

Yes. Both have their own sections.

Is it only frontend?

No. Promises, modules, error handling, and strings apply to Node too.

How long until I notice a difference?

A week or two of daily practice. You will google less.

Is this like LeetCode?

No. LeetCode is algorithms. This is syntax recall.

Are the exercises practical?

Yes. They are patterns you would write at work, not trivia.

Do you cover modern JavaScript?

Yes. ES6+ through current: async/await, modules, hooks, TypeScript.

Do I need React or TypeScript experience?

No. Those topics are optional. Start with core JS.

Do I need to know JavaScript first?

Yes. If you can write a function and use arrays, you are ready. This is not a first course.

How much should I practice?

10 minutes a day. Consistency matters more than long sessions.

What is in modules & scope?

Imports, exports, TDZ, let vs const vs var, live bindings.

Sources
MDN Web Docs (Mozilla)React Official DocsTypeScript HandbookNode.js DocumentationECMAScript Language Specification

Try it. It takes two minutes.

Free daily exercises with spaced repetition. No credit card required.

Syntax Cache

Build syntax muscle memory with spaced repetition.

Product

  • Pricing
  • Our Method
  • Daily Practice
  • Design Patterns
  • Interview Prep

Resources

  • Blog
  • Compare
  • Cheat Sheets
  • Vibe Coding
  • Muscle Memory

Languages

  • Python
  • JavaScript
  • TypeScript
  • Rust
  • SQL
  • GDScript

Legal

  • Terms
  • Privacy
  • Contact

© 2026 Syntax Cache

Cancel anytime in 2 clicks. Keep access until the end of your billing period.

No refunds for partial billing periods.