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


Groups > comp.lang.javascript > #18000 > unrolled thread

Function definition expression has a length property?

Started byThomas Li <cooooooder@gmail.com>
First post2013-01-07 02:02 -0800
Last post2013-01-07 21:49 -0800
Articles 3 — 2 participants

Back to article view | Back to comp.lang.javascript


Contents

  Function definition expression has a length property? Thomas Li <cooooooder@gmail.com> - 2013-01-07 02:02 -0800
    Re: Function definition expression has a length property? Stefan Weiss <krewecherl@gmail.com> - 2013-01-07 11:26 +0100
      Re: Function definition expression has a length property? Thomas Li <cooooooder@gmail.com> - 2013-01-07 21:49 -0800

#18000 — Function definition expression has a length property?

FromThomas Li <cooooooder@gmail.com>
Date2013-01-07 02:02 -0800
SubjectFunction definition expression has a length property?
Message-ID<91b7a4ff-8eb7-4ef2-ac97-4e046024d5f0@googlegroups.com>
Why function definition expression has a "length" property and its value is always 1?
like:
var square = function(x){return x*x;};
square.length

log value from IE9 javascript console:
    >> var square = function(x){return x*x;}; 
    >> square(12) 
    144 
    >> square.length 
    1 

[toc] | [next] | [standalone]


#18002

FromStefan Weiss <krewecherl@gmail.com>
Date2013-01-07 11:26 +0100
Message-ID<kce7s4$h9o$2@news.albasani.net>
In reply to#18000
On 2013-01-07 11:02, Thomas Li wrote:
> Why function definition expression has a "length" property and its value is always 1?

Not just function expressions, every function object has a length
property. Its value is the number of parameters in the function definition.

- stefan

[toc] | [prev] | [next] | [standalone]


#18016

FromThomas Li <cooooooder@gmail.com>
Date2013-01-07 21:49 -0800
Message-ID<850330a4-b85e-41e3-b56c-fd0c53b3ee2a@googlegroups.com>
In reply to#18002
On Monday, January 7, 2013 6:26:12 PM UTC+8, Stefan Weiss wrote:
> On 2013-01-07 11:02, Thomas Li wrote:
> 
> > Why function definition expression has a "length" property and its value is always 1?
> 
> 
> 
> Not just function expressions, every function object has a length
> 
> property. Its value is the number of parameters in the function definition.
> 
> 
> 
> - stefan

Thanks, stefan :)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web