Skip to content

Conversation

@itzshikharofficial12
Copy link

This PR adds runnable JavaScript examples with a test harness to help developers better understand the core concepts.

What's included:

  • New examples/ folder with concise, runnable code examples
  • Test harness supporting both sync and async tests
  • Individual test files for each example
  • Updated README and package.json with examples info
  • All tests passing (7/7)

Examples demonstrate:

  • Call stack behavior (LIFO order)
  • Primitives vs references (value vs reference types)
  • Closures (lexical scope)
  • Map/filter/reduce array operations
  • Event loop (macro vs microtasks)
  • This/call/bind behavior
  • Promises/async/await patterns

How to use:

Run a single example:

node examples/event-loop.js  # or any other example

Run all tests:

npm test

Each example is self-contained and includes expected output in comments.

- Added examples/ folder with concise, runnable code examples
- Created test harness with sync/async support
- Added test files for each example
- Updated README and package.json with examples info
- All tests passing

Examples demonstrate:
- Call stack behavior
- Primitives vs references
- Closures
- Map/filter/reduce
- Event loop
- This/call/bind
- Promises/async/await
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant