Star Pattern In Javascript Using Nested Ifs