Skip to main content
make it more obvious that *s are omitted when j < |n - i|
Source Link
Neil
  • 177.3k
  • 12
  • 74
  • 281

JavaScript (ES6), 83 bytes

f=
n=>[...Array(n+--n)].map((_,i,a)=>a.map((_,j)=>i+j<n|j<i=>j<n-i|j<i-n?``:`*`).join` `).join`
`
<input type=number min=1 oninput=o.textContent=f(+this.value)><pre id=o>

JavaScript (ES6), 83 bytes

f=
n=>[...Array(n+--n)].map((_,i,a)=>a.map((_,j)=>i+j<n|j<i-n?``:`*`).join` `).join`
`
<input type=number min=1 oninput=o.textContent=f(+this.value)><pre id=o>

JavaScript (ES6), 83 bytes

f=
n=>[...Array(n+--n)].map((_,i,a)=>a.map((_,j)=>j<n-i|j<i-n?``:`*`).join` `).join`
`
<input type=number min=1 oninput=o.textContent=f(+this.value)><pre id=o>

Source Link
Neil
  • 177.3k
  • 12
  • 74
  • 281

JavaScript (ES6), 83 bytes

f=
n=>[...Array(n+--n)].map((_,i,a)=>a.map((_,j)=>i+j<n|j<i-n?``:`*`).join` `).join`
`
<input type=number min=1 oninput=o.textContent=f(+this.value)><pre id=o>