You can see that the functions saveand are validatedefined after the function returned the value.
, , , , , . "" (- var, ).
(, , eval), , , : . save validate , , , , return.
, JavaScript (, dataService), :
this- (
env) [[Scope]] env ( )- (
bindings), , ( , , ) - ,
bindings , bindings- ,
bindings arguments, bindings- ,
var, bindings ( ) undefined
§10.4.1 , . ( , , , ... turgid...) , § 10 1999 , , .
(, IE 6)?
. , (, 2005 ) , ( IE6), . , , :
doSomething();
function doSomething() {
}
... .
"" . save validate , , return — :
function dataService() {
var someValue = '';
var service = {
save: save,
someValue: someValue,
validate: validate
};
return service;
var save = function() {
};
var validate = function() {
};
}
save validate ( 9 ), undefined, " .