Skip to content

Instantly share code, notes, and snippets.

@fachryansyah
Created March 30, 2020 15:30
Show Gist options
  • Save fachryansyah/3a11880395a431a5a7134b1110277f64 to your computer and use it in GitHub Desktop.
Save fachryansyah/3a11880395a431a5a7134b1110277f64 to your computer and use it in GitHub Desktop.
const solution = (n) => {
let x = []
let y = []
for(let j = n; j > 0; j--){
for(let i = 0; i < j; i++){
x.push('*')
}
console.log(x.join(''))
x = []
}
for(let j = 1; j < n; j++){
for(let i = -1; i < j; i++){
y.push('*')
}
console.log(y.join(''))
y = []
}
}
solution(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment