Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #30925

Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ?

From Une Bévue <unbewusst.sein@fai.invalid>
Newsgroups comp.lang.javascript
Subject Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ?
Date 2016-07-20 08:20 +0200
Organization Posted through ALPHANET (http://www.alphanet.ch/)
Message-ID <nmn57v$fdj$1@shakotay.alphanet.ch> (permalink)
References <nmmso1$uof$1@shakotay.alphanet.ch> <recursion-20160720050846@ram.dialup.fu-berlin.de>

Show all headers | View raw


Le 20/07/2016 à 06:09, Stefan Ram a écrit :
>   When I
>
> let a = function f( x ){ return x ? x + f( x - 1 ): 0; };
> console.log( a( 2 ));
> let b = a;
> a = null;
> console.log( b( 2 ));
>
>   , I get
>
> 3
> 3
>
>   , but when I
>
> let a = function( x ){ return x ? x + a( x - 1 ): 0; };
> console.log( a( 2 ));
> let b = a;
> a = null;
> console.log( b( 2 ));
>
>   , I only get one
>
> 3
>
>   ; the call »a( x - 1 )« will not be resolved anymore as intended
>   (i.e., recursively), after »a« has been »moved« to »b«.

fine, thanks !

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Une Bévue <unbewusst.sein@fai.invalid> - 2016-07-20 05:55 +0200
  Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Une Bévue <unbewusst.sein@fai.invalid> - 2016-07-20 08:20 +0200
  Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-07-19 23:25 -0700
    Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-07-20 12:15 +0200
      Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-07-20 05:15 -0700
        Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-07-20 15:08 +0200
          Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-07-20 09:23 -0700
          Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Une Bévue <unbewusst.sein@fai.invalid> - 2016-07-23 18:52 +0200
  Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-07-20 12:15 +0200
  Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Stanimir Stamenkov <s7an10@netscape.net> - 2016-07-28 08:31 +0300
    Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Une Bévue <unbewusst.sein@fai.invalid> - 2016-08-01 06:44 +0200

csiph-web