JavaScript Star Pattern Practice with Loops and Functions

🚀 Day 1 of JavaScript Pattern Practice! Today I practiced building a simple star pattern using JavaScript functions. Patterns are a great way to improve your logic and get comfortable with loops. Here's the code I wrote: // Function to print star pattern function printStars(rows) { for (let i = 1; i <= rows; i++) { console.log('*'.repeat(i)); } } // Call the function printStars(4); Output: * ** *** **** ⭐ Key Learnings: Using for loops to control rows Using string.repeat() to create repeated characters Functions help in reusing code easily Looking forward to learning more patterns in the coming days! 💻 #100DaysOfCode #JavaScript #Coding #FrontendDevelopment #Patterns #LearnToCode

To view or add a comment, sign in

Explore content categories