CodeToFun
Learn Programming Free
Tutorials
Languages
Features
About
Sign In
Tutorials
Languages
Features
About
Sign In
Back
/
JavaScript Number Pattern 8
JavaScript Number Pattern 8 (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 Number Pattern 8 - Try It</title> </head> <body> <h1>Descending Prefix Number Triangle</h1> <p>Edit <code>rows</code> and click Run.</p> <pre id="output"></pre> <script> const rows = 5; let result = ""; for (let i = rows; i >= 1; i--) { let line = ""; for (let j = rows; j >= i; j--) { line += j; } result += line + "\n"; } document.getElementById("output").textContent = result; </script> </body> </html>
Lines:
0
| Characters:
0
Live Preview
Auto-refresh on Run