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 7980243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:00:39+00:00 2026-06-04T10:00:39+00:00

!function() { return false; } () I’m aware why you might write something like

  • 0
!function() { return false; } ()

I’m aware why you might write something like this, but I have a question about the way it works. As I understand it, the exclamation mark does two things:

  1. It acts on function() { return false; }, changing it into an expression
  2. It also acts on the result of the executed function, so that the whole line evaluates to true

So my questions are:

  1. Is this the correct explanation?
  2. If it is correct, then since () binds more tightly than !, how did the first part (the change of the function itself into an expression) happen? Why doesn’t the exclamation mark act on the whole line throughout?
  • 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-06-04T10:00:41+00:00Added an answer on June 4, 2026 at 10:00 am

    1) It doesnt “change” it. It makes so when the parser goes through the “function” bit it goes expecting an expression, so the “function” is parsed as part of an (possibly anonymous) function expression instead of as a function statement.

    2) It is acting on the whole line. If you look at the precedences, as suggested by jbabey, you see that function call binds more tightly then the negation operator so the whole like is evaluated as

    ! ((function(){})());
    

    Or in a similar, perhaps more readable version:

    var f = function(){ ... };
    ! (f());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have such code: function allValid() { $('input').each(function(index) { if(something) { return false; }
i have this code $(function() { $('#ans_vote a span').click(function(){alert('working');return false;});}); and this html <div
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
return false seems to work in the submitHandler but I'm not sure why. function
$('form').submit(function(){ this.action=http://www.sitename.com/post; return false; }); having altered the action attribute of the form ,i
$(a.close).click(function() { var id = $(this).attr(id); alert(id); $(this).parents(div.venue:first).fadeOut(Fast); return false; }); Any ideas why
$('.chat').submit(function() { $.post(, $(this).serialize(), function(response) { $(this).closest('.stake_chat').prepend(???); }); return false; }); Where ??? is
I have this function: <script type='text/javascript'> $('#clicktogohome').live('click', function(){ history.pushState({}, '', this.href); popstate(this.href); return false;
I´m trying this on Opera 10 and doesn´t work: $('input').keydown(function(){ return false; }); This
I have window.onload = function() { $('form').submit(function() { return false; }); }; Inside of

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.