Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Half or Left Triangle Pattern in JavaScript

// Half or Left Triangle Pattern in JavaScript
let numberleft = 5;
let stringleft = '';
for(let i=1; i<=numberleft; i++){
  for(let j=1; j<=i; j++){
    stringleft += '*';
  }
  for(let k=1; k<= numberleft -i; k++){
    stringleft += ' ';
  }
  stringleft += '
';
}
console.log(stringleft);
 
PREVIOUS NEXT
Tagged: #Half #Left #Triangle #Pattern #JavaScript
ADD COMMENT
Topic
Name
6+8 =