Skip to main content
Commonmark migration
Source Link

#JavaScript (ES6), 33 28 25 24 bytes

JavaScript (ES6), 33 28 25 24 bytes

n=>g=(x=n)=>--x?n*g(x):n

##Try It

Try It

f=
n=>g=(x=n)=>--x?n*g(x):n
o.innerText=f(i.value=3)()
i.oninput=_=>o.innerText=f(+i.value)()
<input id=i min=1 type=number><pre id=o>


##History ###25 bytes f=(n,x=n)=>--x?nf(n,x):n ###28 bytes n=>eval(1+(""+n).repeat(n)) ###33 bytes n=>eval(Array(n).fill(n).join*)

History

25 bytes

f=(n,x=n)=>--x?n*f(n,x):n

28 bytes

n=>eval(1+("*"+n).repeat(n))

33 bytes

n=>eval(Array(n).fill(n).join`*`)

#JavaScript (ES6), 33 28 25 24 bytes

n=>g=(x=n)=>--x?n*g(x):n

##Try It

f=
n=>g=(x=n)=>--x?n*g(x):n
o.innerText=f(i.value=3)()
i.oninput=_=>o.innerText=f(+i.value)()
<input id=i min=1 type=number><pre id=o>


##History ###25 bytes f=(n,x=n)=>--x?nf(n,x):n ###28 bytes n=>eval(1+(""+n).repeat(n)) ###33 bytes n=>eval(Array(n).fill(n).join*)

JavaScript (ES6), 33 28 25 24 bytes

n=>g=(x=n)=>--x?n*g(x):n

Try It

f=
n=>g=(x=n)=>--x?n*g(x):n
o.innerText=f(i.value=3)()
i.oninput=_=>o.innerText=f(+i.value)()
<input id=i min=1 type=number><pre id=o>


History

25 bytes

f=(n,x=n)=>--x?n*f(n,x):n

28 bytes

n=>eval(1+("*"+n).repeat(n))

33 bytes

n=>eval(Array(n).fill(n).join`*`)
added 57 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

#JavaScript (ES6), 33 28 2325 24 bytes

n=>g=(n,x=n)=>--x?n*fn*g(n,x):n

##Try It

f=
n=>g=(n,x=n)=>--x?n*fn*g(n,x):n
o.innerText=f(i.value=3)()
i.oninput=_=>o.innerText=f(+i.value)()
<input id=i min=1 type=number><pre id=o>


##History ###28###25 bytes n=>eval(1+f=("*"+nn,x=n)=>--x?nf(n,x):n ###28 bytes n=>eval(1+(""+n).repeat(n)) ###33 bytes n=>eval(Array(n).fill(n).join*)

#JavaScript (ES6), 33 28 23 bytes

(n,x=n)=>--x?n*f(n,x):n

##Try It

f=
(n,x=n)=>--x?n*f(n,x):n
o.innerText=f(i.value=3)
i.oninput=_=>o.innerText=f(+i.value)
<input id=i min=1 type=number><pre id=o>


##History ###28 bytes n=>eval(1+("*"+n).repeat(n)) ###33 bytes n=>eval(Array(n).fill(n).join*)

#JavaScript (ES6), 33 28 25 24 bytes

n=>g=(x=n)=>--x?n*g(x):n

##Try It

f=
n=>g=(x=n)=>--x?n*g(x):n
o.innerText=f(i.value=3)()
i.oninput=_=>o.innerText=f(+i.value)()
<input id=i min=1 type=number><pre id=o>


##History ###25 bytes f=(n,x=n)=>--x?nf(n,x):n ###28 bytes n=>eval(1+(""+n).repeat(n)) ###33 bytes n=>eval(Array(n).fill(n).join*)

deleted 194 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

#JavaScript (ES6), 33 28 23 bytes

(n,x=n)=>--x?n*f(n,x):n

Add 7 bytes if we need to allow for negative integers.

(n,x=n>0?n:-n)=>--x?n*f(n,x):n

And add 3 bytes if 0 should be output for input 0

(n,x=n>0?n:-n)=>n&&--x?n*f(n,x):n

##Try It

f=
(n,x=n)=>--x?n*f(n,x):n
o.innerText=f(i.value=3)
i.oninput=_=>o.innerText=f(+i.value)
<input id=i min=0min=1 type=number><pre id=o>


##History ###28 bytes n=>eval(1+("*"+n).repeat(n)) ###33 bytes n=>eval(Array(n).fill(n).join*)

#JavaScript (ES6), 33 28 23 bytes

(n,x=n)=>--x?n*f(n,x):n

Add 7 bytes if we need to allow for negative integers.

(n,x=n>0?n:-n)=>--x?n*f(n,x):n

And add 3 bytes if 0 should be output for input 0

(n,x=n>0?n:-n)=>n&&--x?n*f(n,x):n

##Try It

f=
(n,x=n)=>--x?n*f(n,x):n
o.innerText=f(i.value=3)
i.oninput=_=>o.innerText=f(+i.value)
<input id=i min=0 type=number><pre id=o>


##History ###28 bytes n=>eval(1+("*"+n).repeat(n)) ###33 bytes n=>eval(Array(n).fill(n).join*)

#JavaScript (ES6), 33 28 23 bytes

(n,x=n)=>--x?n*f(n,x):n

##Try It

f=
(n,x=n)=>--x?n*f(n,x):n
o.innerText=f(i.value=3)
i.oninput=_=>o.innerText=f(+i.value)
<input id=i min=1 type=number><pre id=o>


##History ###28 bytes n=>eval(1+("*"+n).repeat(n)) ###33 bytes n=>eval(Array(n).fill(n).join*)

added 130 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading
added 130 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading
added 446 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading
added 62 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading