On Jan 25, 4:29 pm, "gg9h0st" <mn9h...@hotmail.comwrote:
Quote:
function aa() {};
var bb = new aa();
>
var dd = new function cc() {};
|
Safari throws a parse error here and script execution stops.
Quote:
>
aa.prototype.rr = 100;
cc.prototype.rr = 100;
|
If browsers get past where Safari errors, they will throw one at this
point: window.cc is not defined, attempting to access its prototype
property is doomed to failure.
The reference provided by VK is a good one.
Quote:
i wrote the code above that makes two functions and two object for
those.
>
bb(object)->aa(function),
dd(object)->cc(function).
>
i think it's all the same way to make an object for a function.
|
It isn't.
Quote:
>
but if u try to debug,
>
bb object has rr right after "aa.prototype.rr = 100" statement
but dd deosn't have rr variable.
|
Because an rr property was never added to dd or any object in its scope
chain.
Quote:
>
isn't dd obj refer to cc?
|
dd refers to a function object constructed using the anonymous object
passed to the new operator (except in Safari :-) ). The anonymous
function named cc has probably already ceased to exist.
--
Rob