/    Sign up×
Community /Pin to ProfileBookmark

what is meaning of window.error=true

Is it useful?

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@MrNobodyNov 12.2008 — Depends upon how (the context in which) it is used. I have never seen such an assignment used before, though. I have seen where a similar construct would be used to see if a window has encountered an error during loading. For example:
[CODE]window.onerror = function()
{
alert(this.location.href + ' did not load successfully.);
}[/CODE]

Otherwise, I am not aware of any [B]error[/B] property for the [B]window[/B] object. Thus, this could be used to create a custom property in the [B]window[/B] object for any number of uses.
Copy linkTweet thisAlerts:
@felgallNov 13.2008 — window.error = true;

is equivalent to

var error = true;

All newly created variables are properties of the window object.
Copy linkTweet thisAlerts:
@MrNobodyNov 13.2008 — All newly created variables are properties of the window object.[/QUOTE]
You needed to qualify that. Because newly created variables inside of a function are not properties of the window object.
Copy linkTweet thisAlerts:
@felgallNov 13.2008 — All newly created variables [b]that are not created inside functions[/b] are properties of the window object.[/QUOTE]

Those created inside functions are properties of the function.
Copy linkTweet thisAlerts:
@MrNobodyNov 13.2008 — Duh! Good job of glossing over (ignoring) the original issue. Those three words "that is true" or "you are correct" just don't come out, eh? :rolleyes:
Copy linkTweet thisAlerts:
@tianxzauthorNov 13.2008 — I know it
Copy linkTweet thisAlerts:
@felgallNov 14.2008 — Duh! Good job of glossing over (ignoring) the original issue. Those three words "that is true" or "you are correct" just don't come out, eh? :rolleyes:[/QUOTE]

You pointed out an error in my original statement and I therefore corrected my statement. I apologise for forgetting to thank you for pointing out the error in my original statement.
×

Success!

Help @tianxz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...