0

when creating a new function in v8, one can pass a length parameter (docs). But I couldn't find out what it is good for as it does not seem to have any direct effect...

v8::Function::New(ctx, callback, data, length);
Databyte
  • 1,420
  • 1
  • 15
  • 24

1 Answers1

2

JavaScript functions have a length property:

function foo(a, b, c) {}
var len = foo.length;  // 3

When you create a function on the C++ side, the length parameter to v8::Function::New (or v8::FunctionTemplate::New) allows you to specify the value of the resulting function's length property.

jmrk
  • 34,271
  • 7
  • 59
  • 74