Conversation started Dec 12, 2016 at 17:35.
obarakon
Dec 12, 2016 17:35
Can you use recursion in JavaScript? The following code is throwing a call stack exception
f=n=>n==3?true:f(n++)
calling
f(1)
. Also, let me know if this is not the place to ask.
TuxCopter
You should be using
++n
Kritixi Lithos
Try
f(++n)
instead since when you call
f(n++)
the original value of
n
(1) is passed to
f
and then n is incremented
TuxCopter
n++
evaluates to
n
and
increment
n
Kritixi Lithos
semi-ninja'd
TuxCopter
@KritixiLithos Half-ninja'd?
Martin Ender
Dec 12, 2016 17:37
ninja sandwich
TuxCopter
Ninja'd
Re-ninja'd
Kritixi Lithos
double-semi-ninja'd
Gabriel Benamy
super-ninja ronpa 2: goodbye ninjas
obarakon
Ha, nice. Thanks, that worked
El'endia Starman
*kills all the ninjas*
Conversation ended Dec 12, 2016 at 17:44.
all rooms
re double semi-ninja'd sandwich 2:goodbye ninjas
Dec '16
12
The Nineteenth Byte
The Nineteenth Byte: General discussion for
codegolf.stackexc...
10
context of the conversation
join this room
about this room
Participants
TuxCopter
38%
Kritixi Lithos
23%
obarakon
15%
Martin Ender
7%
Gabriel Benamy
7%
El'endia Starman
7%
all times are UTC
site design / logo © 2025 Stack Exchange Inc;
legal
mobile