CodeToFun
Learn Programming Free
Tutorials
Languages
Features
About
Sign In
Tutorials
Languages
Features
About
Sign In
Back
/
JavaScript Star Pattern 2
JavaScript Star Pattern 2 (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 Star Pattern 2 - Try It</title> </head> <body> <h1>Inverted Right-Angled Triangle Star Pattern</h1> <p>Open the HTML code and change <code>rows</code>, then click Run.</p> <pre id="output"></pre> <script> (() => { // Change this value to try different sizes const rows = 5; let result = ""; for (let i = rows; i >= 1; i--) { for (let j = 1; j <= i; j++) { result += "*"; } result += "\n"; } document.getElementById("output").textContent = result; })(); </script> </body> </html>
Lines:
0
| Characters:
0
Live Preview
Auto-refresh on Run