pattern

JavaScript for build JavaScript Logic to use pattern

pattern 1

 <script type=”text/javascript”>

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

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

                document.write(“&nbsp;&nbsp;”);

            }

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

                document.write(“*”);

            }

            document.write(“<br>”);

        }

    </script>

pattern 2

 <script type=”text/javascript”>

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

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

                document.write(“&nbsp;&nbsp;”);

            }

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

                document.write(“*”);

            }

            document.write(“<br>”);

        }

        </script>

pattern 3

 <script>

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

            for(let k=5;k>=i;k–){

                document.write(“&nbsp;&nbsp;”)

            }

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

                document.write(“*”);

            }

            document.write(“<br>”)

        }

    </script>

JAVASCRIPT INTRO

  • Javascript was made by Brendan Eich in 1995.
  • Javascript old name is livescript. at this time latest name is javascript.
  • 98.0% website using javascript.
  • The first original JavaScript main revision is invented in ES5 (2009).and second main revision ES6(2015).and every year additions (2016,2017,2018,2019,2020).

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style type="text/css">
            #box{
                width: 300px;
                height: 150px;
                background-color: aqua;
                color: black;
            }
        </style>
    </head>
    <body>
        <div id="box">my name is sachin</div>
        <button onclick="message()">click me</button>
        <script type="text/javascript">
            function message(){
                alert('welcome to my website and you are the boss');
            }
        </script>
    </body>
    </html>