Welcome to JS-PatternGallery, a collection of diverse JavaScript pattern programs! Whether you're learning loops, honing your logical thinking, or just exploring visual coding, this repository offers a rich variety of shapes and patterns.
- 💻 25+ Pattern Programs: From simple triangles to complex palindromes.
- 🔥 Interactive Examples: Each pattern is displayed alongside its source code for easy access.
- 📂 Organized Structure: Clear, concise JavaScript implementations.
- 🧠 Ideal for Practice: Strengthen your understanding of nested loops, conditionals, and logic.
To get a copy of this repository on your local machine, use the following command:
git clone https://github.com/sagarbangade/JS-PatternGallery.gitNavigate into the directory:
cd JS-PatternGalleryOpen any .js file in your preferred code editor and run it in your browser's console or Node.js environment to see the pattern!
All the pattern programs can be executed using Node.js. Clone this repository and run the JavaScript files in your terminal:
node filename.jsFor example:
node pyramid_pattern.jsThe table below contains visual previews of the patterns along with their corresponding file names. Click on the pattern name to view the source code.
| Pattern Name | Visual Example | Source Code |
|---|---|---|
| Binary Triangle Pattern | 110101101010101101010101010110101010 |
binary_triangle_pattern.js |
| Bricks Pattern | [] [] [] [] [] [] [] [] [] [][] [] [] [] [] [] [] [] [] [] |
bricks.js |
| Diamond Pattern | * ******** *** * |
diamond_pattern.js |
| Half Diamond Pattern | ************************* |
half_diamond_pattern.js |
| Hollow C Pattern | * * * * ***** * * * * |
hollow_C_pattern.js |
| Hollow Diamond Pattern | * * * * * * ** * * * * * * * * |
hollow_diamond_pattern.js |
| Hollow N Pattern | * * * * ** ** ** ** * * * * |
hollow_n_pattern.js |
| Hollow Pyramid Pattern | * * * * * * ********** |
hollow_pyramid_pattern.js |
| Hollow Right Triangle Pattern | **** ** ****** |
hollow_right_triangle_pattern.js |
| Hollow Square Pattern | * * * * ** ** ** ** * * * * |
hollow_square_pattern.js |
| Hollow U Pattern | * ** ** ** ** * * * * |
hollow_U_pattern.js |
| Inverted Number Pyramid | 54321 4321 321 21 1 |
inverted_number_pyramid_pattern.js |
| Mirror C Pattern | * * * * * * * ** * * * * |
mirror_C_pattern.js |
| Number Palindrome Triangle | 1 121 12321 1234321123454321 |
number_palindrome_triangle_pattern.js |
| Number Pyramid Pattern | 1 222 33333 4444444555555555 |
number_pyramid_pattern.js |
| Number Rectangle | 1 2 3 4 51 2 3 4 51 2 3 4 51 2 3 4 51 2 3 4 5 |
number_rectangle.js |
| Number Square Pattern | 1 2 34 5 67 8 9 |
number_square_pattern.js |
| Parallelogram Pattern | ***** ***** ***** ********** |
parallelogram_pattern.js |
| Pen Tree Pattern | * *** ***** ******* | |
penTree.js |
| Pyramid Pattern | * *** ***** **************** |
pyramid_pattern.js |
| Reverse Left Triangle Pattern | * * * * ** * * ** * ** ** |
reverse_left_triangle_pattern.js |
| Reverse Number Rectangle | 4 3 2 14 3 2 14 3 2 14 3 2 1 |
reverse_number_rectangle.js |
| Right Angle Triangle Pattern | *************** |
right_angle_triangle_pattern.js |
| Right Triangle Using Numbers | 112123123412345 |
right_triangle_pattern_using_numbers.js |
| W Pattern | \ / \ / \ / \ / \ / \ / \ / \ / \/ \/ |
W_pettern.js |
| Zigzag Border Pattern | +/\/\/\/\/\++\/\/\/\/\/++/\/\/\/\/\++\/\/\/\/\/++/\/\/\/\/\++\/\/\/\/\/++/\/\/\/\/\++\/\/\/\/\/+ |
zigzag_border_pattern.js |
| Z Pattern | ***** * * ****** |
Z_pattern.js |
Contributions are welcome! If you'd like to contribute new patterns or improve existing ones, feel free to:
- Fork this repository.
- Make the changes.
- Submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
Created by Sagar Eknath Bangade.
For more of my work, check out my portfolio.