Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 996065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:49:13+00:00 2026-05-16T06:49:13+00:00

What does the following mean in JavaScript? var evt=event||window.event;

  • 0

What does the following mean in JavaScript?

var evt=event||window.event;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:49:14+00:00Added an answer on May 16, 2026 at 6:49 am

    It means that the variable evt is assigned to the value of event or if event is undefined it is assigned the value of window.event.

    How this works is that in javascript, boolean operators don’t evaluate to true or false but instead evaluates to the value of the last object that is not falsy* or the falsy value.

    So the statement first evaluates the expression event || window.event. If event is true then the expression does not need to be evaluated any further since an OR only needs one member to be true. Therefore the value of event is returned. If event is falsy then the the right side of the OR operator needs to be evaluated to determine if the result is false. In which case, if window.event is not falsy then its value is returned.

    This is a very common idiom to get the event object from event handlers. On standards compliant browsers, the event object is passed as the first parameter to the event handler. But on IE the event object is a global variable. And for historical reasons, all global variables are members of the window object.

    So the code should look something like this:

    element.onclick = function (event) {
      var evt = event ||     // use the value of event if available or
                window.event;// if not assume it's IE and use window.event
    
      /* ... */
    }
    

    Note: * falsy values in javascript are: false, 0, null and undefined.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What does the following javascript code mean? I guess it's defining a function within
Possible Duplicate: What does this mean? (function (x,y)){…}){a,b); in JavaScript I have the following
What does the following code mean in Ruby? ||= Does it have any meaning
In some Bison code, what does the following line mean? #define YY_DECL extern C
What does the following C++ code mean? unsigned char a : 1; unsigned char
What does the following error message mean? cannot override a concrete member without a
What does the path in an action of the following action-mapping mean .Does it
What does MYSQL mean in the following code. require_once (MYSQL);
What does the colon mean in the following Perl program? MAIN: { print Hello\n;
What does the underscore mean in the following regex? [a-zA-Z0-9_] The _ seems to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.