CodeToFun
Learn Programming Free
Tutorials
Languages
Features
About
Sign In
Tutorials
Languages
Features
About
Sign In
Back
/
JavaScript Alphabet Pattern 32
JavaScript Alphabet Pattern 32 (Try It)
Try It
Run
Reset
Save
Save to Google Drive
Sync with your Google account
Download HTML
Save to your device
Share
Full
HTML Code
Copy
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>JS Alphabet Pattern 32 - Try It</title> <style> body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; } #output { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 20px; line-height: 1.35; white-space: pre; margin-top: 12px; } </style> </head> <body> <h1>Centered palindrome pyramid</h1> <p>Edit <code>top</code> or indentation width, then click Run.</p> <pre id="output"></pre> <script> (() => { const A = "A".charCodeAt(0); const top = "E".charCodeAt(0); let result = ""; for (let i = A; i <= top; i++) { let line = ""; for (let j = top; j >= i; j--) line += " "; for (let k = A; k <= i; k++) line += String.fromCharCode(k); for (let k = i - 1; k >= A; k--) line += String.fromCharCode(k); result += line + "\n"; } document.getElementById("output").textContent = result; })(); </script> </body> </html>
Lines:
0
| Characters:
0
Live Preview
Auto-refresh on Run