Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Reverse pyramid star pattern in JavaScript

// Reverse pyramid Or Triangle star pattern in JavaScript
let numberPyramid = 5;
let stringPyramid = '';
for(let i=1; i<=numberPyramid; i++){
  for(let j=1; j<=i -1; j++){
    stringPyramid += ' ';
  }
  for(let k=i; k<=2 * numberPyramid -i; k++){
    stringPyramid += '*';
  }
  stringPyramid += '
';
}
console.log(stringPyramid);
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to wait a determined amount of time before doing something in js 
Javascript :: node js send fcm 
Javascript :: javascript date example 
Javascript :: how to include in ejs 
Javascript :: error: expected undefined to be a graphql schema. 
Javascript :: shuffle an array of numbers in javascript 
Javascript :: joi or null 
Javascript :: kb to mb js 
Javascript :: node.js f string 
Javascript :: to add autofix when saving files in Eslint 
Javascript :: js first letter to uppercase 
Javascript :: invert binary tree javascript 
Javascript :: javascript index of min value in array 
Javascript :: access to model from js 
Javascript :: jquery add multiple attribute to element by class 
Javascript :: placeholder js 
Javascript :: jquery get name attribute 
Javascript :: how to create a global variable in vue 
Javascript :: how to pass sequelize transaction to association helper method 
Javascript :: express-generator 
Javascript :: get last element in an array jqury 
Javascript :: Select options of Select2 control based on values using Jquery 
Javascript :: how to set cookies in node js 
Javascript :: pageyoffset jquery 
Javascript :: how to reload the window by click on button in javascript 
Javascript :: how to use ctx on canvas js 
Javascript :: javascript create range with a loop 
Javascript :: html2canvas angular 
Javascript :: how to detect a url change 
Javascript :: email id domain check javascript 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =