🎮 Interactive Code Playground Demo
Welcome to the interactive code playground! This page demonstrates all three components you can use in your courses.
1. 📝 CodePlayground - Live Code Execution
Try writing and running JavaScript code directly in your browser:
Try JavaScript
JavaScriptFeatures You Can Try:
- ✏️ Edit the code and click “Run Code”
- 💾 Your changes are auto-saved
- 📋 Copy code to clipboard
- ⬇️ Download as a file
- 🔗 Share your code via URL
2. 🎯 CodeChallenge - Interactive Coding Challenges
Test your skills with this FizzBuzz challenge:
FizzBuzz Challenge
Write a function that returns 'Fizz' for multiples of 3, 'Buzz' for multiples of 5, and 'FizzBuzz' for multiples of both.
Challenge Features:
- ✅ Automatic test case validation
- 💡 Progressive hints (unlock one at a time)
- 👀 View solution when stuck
- 📊 Score tracking
- 💾 Auto-save your progress
3. 🔧 Advanced Challenge - Array Manipulation
Ready for something harder? Try this array challenge:
Find Duplicates in Array
Write a function that finds all duplicate values in an array and returns them in a new array (no duplicates in result).
4. 🏖️ CodeSandbox - Full Project Environments
React Todo App Sandbox
Explore a complete React project running in the browser:
React Todo App
CodeSandboxNote: Replace sandboxId with your actual CodeSandbox ID
Features:
- 🎨 Full IDE experience in browser
- 📦 Install npm packages
- 🔄 Live preview
- 🌓 Dark/light theme
- 📱 Responsive preview
5. ⚡ StackBlitz Integration
Try this Vite + React starter:
Vite + React Starter
StackBlitzNote: Replace stackblitzId with your actual StackBlitz project ID
6. 💻 TypeScript Playground
TypeScript Example
TypeScript7. 🐍 Python Code Display
Python Example (Display Only)
PythonNote: Python execution requires backend support. This shows syntax highlighting and editing.
8. ☕ Java Code Display
Java Example (Display Only)
Java🎓 How to Use in Your Courses
For Simple Code Examples:
<CodePlayground
language="javascript"
title="Your Title"
initialCode={`console.log("Hello!");`}
client:load
/>
For Coding Challenges:
<CodeChallenge
title="Challenge Title"
difficulty="easy"
initialCode={`function solve() { }`}
testCases={[
{ input: 5, expected: 25 }
]}
solution={`function solve(n) { return n * n; }`}
hints={["Think about multiplication"]}
client:load
/>
For Full Projects:
<CodeSandbox
sandboxId="your-sandbox-id"
title="Project Title"
client:load
/>
🚀 Next Steps
- Practice: Try solving the challenges above
- Experiment: Modify the code examples
- Create: Use these components in your own courses
- Share: Share your solutions with friends
Happy coding! 🎉