CodeToFun
Learn Programming Free
Tutorials
Languages
Features
About
Sign In
Tutorials
Languages
Features
About
Sign In
Back
/
JavaScript Alphabet Pattern 33
JavaScript Alphabet Pattern 33 (Try It — Browser)
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 33 - Try It (Browser)</title> </head> <body> <h1>Hollow pyramid (document.write)</h1> <p>Edit the loops, then click Run.</p> <script> const A = 65; const last = 69; for (let i = A; i <= last; i++) { for (let j = last; j >= A; j--) { if (i === j) document.write(String.fromCharCode(j)); else document.write(" "); } for (let k = A + 1; k <= last; k++) { if (i === k) document.write(String.fromCharCode(k)); else document.write(" "); } document.write("<br>"); } </script> </body> </html>
Lines:
0
| Characters:
0
Live Preview
Auto-refresh on Run