Skip to main content
Commonmark migration
Source Link

#JavaScript (ES6), 70 67 64 bytes

JavaScript (ES6), 70 67 64 bytes

a=>(z=[...Array(a)].map((b,c)=>c+1)).join``- -z.reverse().join``

Fixed to meet requirement, as old code was made under misunderstanding of the input.

#JavaScript (ES6), 70 67 64 bytes

a=>(z=[...Array(a)].map((b,c)=>c+1)).join``- -z.reverse().join``

Fixed to meet requirement, as old code was made under misunderstanding of the input.

JavaScript (ES6), 70 67 64 bytes

a=>(z=[...Array(a)].map((b,c)=>c+1)).join``- -z.reverse().join``

Fixed to meet requirement, as old code was made under misunderstanding of the input.

deleted 3 characters in body
Source Link
Mwr247
  • 3.6k
  • 18
  • 39

#JavaScript (ES6), 6770 67 64 bytes

a=>[...a=>(z=[...Array(a)].map((b,c)=>c+1)].reverse().join``- -z.reverse().join``

Fixed to meet requirement, as old code was made under misunderstanding of the input.

#JavaScript (ES6), 67 bytes

a=>[...z=[...Array(a)].map((b,c)=>c+1)].reverse().join``- -z.join``

Fixed to meet requirement, as old code was made under misunderstanding of the input.

#JavaScript (ES6), 70 67 64 bytes

a=>(z=[...Array(a)].map((b,c)=>c+1)).join``- -z.reverse().join``

Fixed to meet requirement, as old code was made under misunderstanding of the input.

fixed, and shortened
Source Link
Mwr247
  • 3.6k
  • 18
  • 39

#JavaScript (ES6), 3167 bytes

a=>+[a=>[...a]z=[...Array(a)].map((b,c)=>c+1)].reverse().join``+a*1join``- -z.join``

Takes input as a numeric string.

The function takes in a string and splits it into an array (using [...a]) in order to take advantage of the reverse function, then join to put it back together. The first + is to coerce the reversed string into a number again. Now we add itFixed to the original number with +a*1meet requirement, whereas old code was made under misunderstanding of the *1 is likewise used to coerce it into a numberinput.

#JavaScript (ES6), 31 bytes

a=>+[...a].reverse().join``+a*1

Takes input as a numeric string.

The function takes in a string and splits it into an array (using [...a]) in order to take advantage of the reverse function, then join to put it back together. The first + is to coerce the reversed string into a number again. Now we add it to the original number with +a*1, where the *1 is likewise used to coerce it into a number.

#JavaScript (ES6), 67 bytes

a=>[...z=[...Array(a)].map((b,c)=>c+1)].reverse().join``- -z.join``

Fixed to meet requirement, as old code was made under misunderstanding of the input.

explaination
Source Link
Mwr247
  • 3.6k
  • 18
  • 39
Loading
Source Link
Mwr247
  • 3.6k
  • 18
  • 39
Loading