Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Half or Right Triangle star pattern in JavaScript

// Half or Right Triangle star pattern in JavaScript
let numberValue = 5;
let stringValue = '';
for(let i=1; i<=numberValue; i++){
  for(let j=1; j<= numberValue - i; j++){
    stringValue += ' ';
  }
  for(let k=1; k<=i; k++){
    stringValue += '*';
  }
  stringValue += '
';
}
console.log(stringValue);
 
PREVIOUS NEXT
Tagged: #Half #Right #Triangle #star #pattern #JavaScript
ADD COMMENT
Topic
Name
1+9 =