Search
 
SCRIPT & CODE EXAMPLE
 

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);
Comment

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);
Comment

PREVIOUS NEXT
Code Example
Javascript :: js any array member true 
Javascript :: svelte on destroy 
Javascript :: react hooks link to external site 
Javascript :: appregistry react native 
Javascript :: Find largest number from array by function in javascript 
Javascript :: react-intersection-observer 
Javascript :: vuejs slots events 
Javascript :: Printer Print using HTML 
Javascript :: Define Number Prop Vue 
Javascript :: random between min and max 
Javascript :: how to not use relative imports in react js 
Javascript :: Custom delay function for waitfor puppeteer 
Javascript :: call dynamic var name javascript 
Javascript :: cheerio library to parse the meta tags in url 
Javascript :: IntersectionObserver polyfill 
Javascript :: waypoint 
Javascript :: The element.appendChild() Method 
Javascript :: cypress check element has an attribute 
Javascript :: slice 
Javascript :: koa access request body 
Javascript :: contact form angular material 
Javascript :: js after settimeout 
Javascript :: react google map api 
Javascript :: node.js upload files 
Javascript :: react firebase add doc to collection 
Javascript :: react native refresh control color 
Javascript :: Font Size changed from device OS react native app 
Javascript :: chart js more data than labels 
Javascript :: formula regex para validar cpf e cnpj no google forms 
Javascript :: connect to redux store outside component 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =