Skip to main content
Commonmark migration
Source Link

#Javascript es7, 105 bytes

Javascript es7, 105 bytes

A=>[...Array(10)].map((a,i)=>' '.repeat((d=A<i)?A:i)+('-'+(i+1+'').repeat(d?0:i<9?2*(A-i):1)+'-')).join`
`

call with

f=A=>[...Array(10)].map((a,i)=>' '.repeat((d=A<i)?A:i)+('-'+(i+1+'').repeat(d?0:i<9?2*(A-i):1)+'-')).join`
`


f(10)
f(5)
f(0)

#Javascript es7, 105 bytes

A=>[...Array(10)].map((a,i)=>' '.repeat((d=A<i)?A:i)+('-'+(i+1+'').repeat(d?0:i<9?2*(A-i):1)+'-')).join`
`

call with

f=A=>[...Array(10)].map((a,i)=>' '.repeat((d=A<i)?A:i)+('-'+(i+1+'').repeat(d?0:i<9?2*(A-i):1)+'-')).join`
`


f(10)
f(5)
f(0)

Javascript es7, 105 bytes

A=>[...Array(10)].map((a,i)=>' '.repeat((d=A<i)?A:i)+('-'+(i+1+'').repeat(d?0:i<9?2*(A-i):1)+'-')).join`
`

call with

f=A=>[...Array(10)].map((a,i)=>' '.repeat((d=A<i)?A:i)+('-'+(i+1+'').repeat(d?0:i<9?2*(A-i):1)+'-')).join`
`


f(10)
f(5)
f(0)
added 10 characters in body
Source Link
Charlie Wynn
  • 806
  • 1
  • 6
  • 12

#Javascript es7, 106105 bytes

A=>[...Array(10)].map((a,i)=>' '.repeat((d=A<i)?A:i)+('-'+(i+1+'').repeat(d?0:i<9?2*(A-i):1)+'-')).join`\n`join`
`

call with

f=A=>[...Array(10)].map((a,i)=>' '.repeat((d=A<i)?A:i)+('-'+(i+1+'').repeat(d?0:i<9?2*(A-i):1)+'-')).join`\n`join`
`


f(10)
f(5)
f(0)

#Javascript es7, 106 bytes

A=>[...Array(10)].map((a,i)=>' '.repeat((d=A<i)?A:i)+('-'+(i+1+'').repeat(d?0:i<9?2*(A-i):1)+'-')).join`\n`

call with

f=A=>[...Array(10)].map((a,i)=>' '.repeat((d=A<i)?A:i)+('-'+(i+1+'').repeat(d?0:i<9?2*(A-i):1)+'-')).join`\n`

f(10)
f(5)
f(0)

#Javascript es7, 105 bytes

A=>[...Array(10)].map((a,i)=>' '.repeat((d=A<i)?A:i)+('-'+(i+1+'').repeat(d?0:i<9?2*(A-i):1)+'-')).join`
`

call with

f=A=>[...Array(10)].map((a,i)=>' '.repeat((d=A<i)?A:i)+('-'+(i+1+'').repeat(d?0:i<9?2*(A-i):1)+'-')).join`
`


f(10)
f(5)
f(0)
added 9 characters in body
Source Link
Charlie Wynn
  • 806
  • 1
  • 6
  • 12

#Javascript es7, 106 bytes

A=>[...Array(10)].map((a,i)=>' '.repeat(A<i(d=A<i)?A:i)+(A<i?'--':('-'+(i+1+'').repeat(d?0:i<9?(2*(A-i)):1)+'-'))).join`\n`

call with

f=A=>[...Array(10)].map((a,i)=>' '.repeat(A<i(d=A<i)?A:i)+(A<i?'--':('-'+(i+1+'').repeat(d?0:i<9?(2*(A-i)):1)+'-'))).join`\n`

f(10)
f(5)
f(0)

#Javascript es7

A=>[...Array(10)].map((a,i)=>' '.repeat(A<i?A:i)+(A<i?'--':('-'+(i+1+'').repeat(i<9?(2*(A-i)):1)+'-'))).join`\n`

call with

f=A=>[...Array(10)].map((a,i)=>' '.repeat(A<i?A:i)+(A<i?'--':('-'+(i+1+'').repeat(i<9?(2*(A-i)):1)+'-'))).join`\n`

f(10)
f(5)
f(0)

#Javascript es7, 106 bytes

A=>[...Array(10)].map((a,i)=>' '.repeat((d=A<i)?A:i)+('-'+(i+1+'').repeat(d?0:i<9?2*(A-i):1)+'-')).join`\n`

call with

f=A=>[...Array(10)].map((a,i)=>' '.repeat((d=A<i)?A:i)+('-'+(i+1+'').repeat(d?0:i<9?2*(A-i):1)+'-')).join`\n`

f(10)
f(5)
f(0)
Source Link
Charlie Wynn
  • 806
  • 1
  • 6
  • 12
Loading