JSFiddle - React, Tailwind, and code Playground

by Vipin Patil

JavaScript

var number_of_stars = 6;
  number_of_rows = number_of_stars;

        for (rows=1; rows <= number_of_rows; rows++) {
                for (spaces=1; spaces <= number_of_stars; spaces++) {
                        document.write("&nbsp;");
                }
                for (star=1; star <= rows; star++) {
                    
                    document.write(spaces);
                    //documemnt.write("*");
                    document.write("&nbsp;");
                }
               document.write("<br>");
                number_of_stars = number_of_stars - 1;
        }