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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:17:31+00:00 2026-05-23T21:17:31+00:00

I wrote a self invoking function in both firefox and chrome it it wouldn’t

  • 0

I wrote a self invoking function in both firefox and chrome it it wouldn’t invoke.

I wrote something to the effect of

(function () { alert("THE"); })();

do self invoking functions not work in current browsers?

I did include all essential tags and all other code works on the page

  • 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-23T21:17:31+00:00Added an answer on May 23, 2026 at 9:17 pm

    “Self-invoking functions” are not really a part of javascript, it’s just a term that people are calling a specific pattern of code (like AJAX, etc.); these patterns should work anywhere that javascript works.

    What you’re calling a “self-invoking function” is just creating an anonymous function and immediately calling it (as opposed to say storing it in a var, as an object value, as a function param, etc.).

    That is, the following are basically the same:

    var f = function(){...}; f()
    

    and

    ( function(){...} )()
    

    So because your ‘self-invoking function’ is a basic part of javascript, there is no possible way it’s not working unless the insides aren’t working or your environment is messed up. You could copy-paste your code onto a new blank page, and it would work fine. Something else must be going wrong:

    Check your errors in your dev console. Specifically, check to make sure you don’t have a syntax error or that there isn’t some weird thing going on with the webpage you’re testing it on (e.g. if you somehow redefine alert…).

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

Sidebar

Related Questions

Here is a related manager I wrote: class PortfolioItemManager(models.Manager): use_for_related_fields = True def extended(self):
I'm self-learning how to create generic functions using iterators. As the Hello World step,
I wrote this just to test the Property function. However, I am getting a
I wrote a java applet and self signed it. When I run it in
I wrote code like this >>> class a(object): def __init__(self): self.__call__ = lambda x:x
class GuestBook(webapp.RequestHandler): def post(self): self.response.out.write( '<h2>You wrote:</h2> %s' %self.request.get('content') ) I want to pass
I wrote a small test program with a sample class containing also self-defined constructor,
I wrote a code (for the experiment:)): class A class << self def self.f
I wrote this function in my RootViewController . appRecord is an object holding an
I wrote an "Agent" Cocoa app where a TextField is in the status icon's

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.