Hi,

On Jan 15, 12:17 am, BeiMingyu <cwen1...@gmail.com> wrote:
> I‘am reading the source code of Function#methodize()  (version1.7).
> But I can't quite understand it.
> 1. How can a function apply to null?  code:  return
> __method.apply(null, a);

If you pass `null` or `undefined` in as the `thisArg` argument of
`call` or `apply`, the global object is used as `thisArg`. (The global
object is `window` on browsers.)
See http://es5.github.com/#x15.3.4.3

> 2. want does it mean "return this._methodized  = function(){}"? Does
> it mean"this._methodized = function(){}; return this._methodized?"

Effectively, yes. The form "x = y" is called an assignment expression.
Like most (all?) expressions, the expression has a value: The value
being assigned. And so "w = x = y;" means "w = (x = y);" Note that
it's the value, not the code, that gets reused. So in "x = y =
foo();", the call to `foo` only happens once; the return value of
`foo` is the value used in "x = y = <value>".
See http://es5.github.com/#x11.13.1

HTH,
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to