The Horatian Archive
Home
Code Editor
write and run JavaScript in the browser
main.js
scratch.js
notes.js
// Welcome to the Code Editor // Write JavaScript and hit Run (or Ctrl+Enter) function fibonacci(n) { if (n <= 1) return n; return fibonacci(n - 1) + fibonacci(n - 2); } // Generate first 15 Fibonacci numbers const fibs = []; for (let i = 0; i < 15; i++) { fibs.push(fibonacci(i)); } console.log("Fibonacci sequence:", fibs.join(", ")); // Fun with arrays const words = ["hello", "world", "code", "editor"]; console.log("Reversed:", words.map(w => w.split('').reverse().join('') )); // Math console.log("Pi to 10 digits:", Math.PI.toFixed(10)); console.log("e to 10 digits:", Math.E.toFixed(10)); console.log("Golden ratio:", ((1 + Math.sqrt(5)) / 2).toFixed(10));
▶ Run (Ctrl+Enter)
Clear Output
Format
Copy
Download
Ex: Sort
Ex: Canvas
Ex: Async
JavaScript
Output
Lines:
0
| Chars:
0