๐ฎ 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! ๐
๐ Learn More
Kambrathi
Published on January 16, 2024