Answers for "how to log a dimand shape in javascript"

0

how to log a dimand shape in javascript

function createDimondShape(size){
   for(var i=1;i<=size;i++){
      for(var s=size-1;s>=i;s--){
         process.stdout.write(" ");
      }
      for(var j=1;j<=i;j++){
         process.stdout.write("* ")
      }
      console.log();
   }
   if(i==size+1){
      for(var i=1;i<=size-1;i++){
         for(var s=1;s<=i;s++){
            process.stdout.write(" ");
         }
         for(j=i;j<=size-1;j++){
            process.stdout.write("* ");
         }
         console.log();
      }
   }
}
createDimondShape(9);
Posted by: Guest on June-12-2021

Code answers related to "how to log a dimand shape in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language