Explore 1.5M+ audiobooks & ebooks free for days

From $11.99/month after trial. Cancel anytime.

150+ JavaScript Pattern Programs
150+ JavaScript Pattern Programs
150+ JavaScript Pattern Programs
Ebook183 pages55 minutes

150+ JavaScript Pattern Programs

Rating: 0 out of 5 stars

()

Read preview

About this ebook

"JavaScript is the Most popular programming language used by professional developers today"

?Develop your creativity bycreating beautiful asterisk patterns with if statements and loops using the JavaScript language. this awesome language will allow you to feel more comfortable writing code because you will master the more essential topics of programming by practicing these techniques.

?If you are studying computer science at university, this book is perfect for you. They will require you to create these types of patterns that will be very useful to learn all types of advanced techniques andquickly master this wonderful language.

Buy NOW and Transform your Coding Skills!

LanguageEnglish
PublisherHernando Abella
Release dateJun 8, 2024
ISBN9798227620293
150+ JavaScript Pattern Programs
Author

Hernando Abella

Hernando Abella is a developer who thoroughly enjoys sharing all the knowledge he has accumulated through his extensive experience. After completing his studies at INCCA University of Colombia, he has dedicated himself to writing programming languages, including Java, C, C++,C#, among others. He has been immersed in the world of programming since the age of 14 and has always harbored a profound passion for coding. his hobbies include cycling and swimming. More About me on : X : Hernando Abella

Read more from Hernando Abella

Related to 150+ JavaScript Pattern Programs

Related ebooks

Programming For You

View More

Reviews for 150+ JavaScript Pattern Programs

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    150+ JavaScript Pattern Programs - Hernando Abella

    Introduction

    Develop your creativity by creating beautiful asterisk patterns with if statements and loops using the JavaScript language. this awesome language will allow you to feel more comfortable writing code because you will master the more essential topics of programming by practicing these techniques.

    If you are studying computer science at university, this book is perfect for you. They will require you to create these types of patterns that will be very useful to learn all types of advanced techniques and quickly master this wonderful language.

    Pattern 1

    // *****

    // *****

    // *****

    // *****

    // *****

    for (let i = 1; i <= 5; i++) {

    let row = '';

    for (let j = 1; j <= 5; j++) {

    row += '*';

    }

    console.log(row);

    }

    Pattern 2

    // *

    // **

    // ***

    // ****

    // *****

    for (let i = 1; i <= 5; i++) {

    let row = '';

    for (let j = 1; j <= i; j++) {

    row += '*';

    }

    console.log(row);

    }

    Pattern 3

    // *****

    // ****

    // ***

    // **

    // *

    for (let i = 1; i <= 5; i++) {

    let row = '';

    for (let j = 5; j >= i; j—) {

    row += '*';

    }

    console.log(row);

    }

    Pattern 4

    //     *

    //    **

    //   ***

    //  ****

    // *****

    const n = 5;

    for (let i = 1; i <= n; i++) {

    let row = '';

    for (let j = n - 1; j >= i; j—) {

    row += ' ';

    }

    for (let k = 1; k <= i; k++) {

    row += '*';

    }

    console.log(row);

    }

    Pattern 5

    // *****

    //  ****

    //   ***

    //    **

    //     *

    const n = 5;

    for (let i = n; i >= 1; i—) {

    let spaces = '';

    for (let j = n - 1; j >= i; j—) {

    spaces += ' ';

    }

    let stars = '';

    for (let k = 1; k <= i; k++) {

    stars += '*';

    }

    console.log(spaces + stars);

    }

    Pattern 6

    //     *

    //    * *

    //   * * *

    //  * * * *

    const p_height = 5;

    for (let i = 1; i < p_height; i++) {

    let spaces = '';

    for (let k = p_height - 1; k >= i; k—) {

    spaces += ' ';

    }

    let stars = '';

    for (let j = 1; j <= i; j++) {

    stars += '* ';

    }

    console.log(spaces + stars);

    }

    Pattern 7

    // * * * * *

    //  * * * *

    //   * * *

    //    * *

    //     *

    const p_height = 5;

    for (let i = p_height; i >= 1; i—) {

    let spaces = '';

    for (let k = p_height - 1; k >= i; k—) {

    spaces += ' ';

    }

    let stars = '';

    for (let j = i; j >= 1; j—) {

    stars += '* ';

    }

    console.log(spaces + stars);

    }

    Pattern 8

    //     *

    //    ***

    //   *****

    //  *******

    // *********

    const p_height = 5;

    let min_stars = 1;

    let p_space = p_height - 1;

    for (let i = 0; i < p_height; i++) {

    let spaces = '';

    for (let j = p_space; j > i; j—) {

    spaces += ' ';

    }

    let stars = '';

    for (let k = 0; k < min_stars; k++) {

    stars += '*';

    }

    min_stars += 2;

    console.log(spaces + stars);

    }

    Pattern 9

    // *********

    //  *******

    //   *****

    //    ***

    //     *

    const p_height = 5;

    let max_stars = p_height * 2 - 1;

    let p_space = p_height - 1;

    for (let i = p_height; i >= 1; i—) {

    let spaces = '';

    for (let j = p_space; j >= i; j—) {

    spaces += ' ';

    }

    let stars = '';

    for (let k = 1; k <= max_stars; k++) {

    stars += '*';

    }

    max_stars -= 2;

    console.log(spaces + stars);

    }

    Pattern 10

    // *

    // **

    // ***

    // ****

    // ***

    // **

    // *

    const size = 3;

    for (let i = size; i >= -size; i—) {

    let row = '';

    for (let j = size; j >= Math.abs(i); j—) {

    row += '*';

    }

    console.log(row);

    }

    Pattern 11

    //    *

    //   **

    //  ***

    // ****

    //  ***

    //   **

    //    *

    const size = 3;

    for (let i = size; i >= -size; i—) {

    let row = '';

    Enjoying the preview?
    Page 1 of 1