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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:19:00+00:00 2026-05-26T05:19:00+00:00

I have two very big functions, a and b , which are currently in

  • 0

I have two very big functions, a and b, which are currently in one big JavaScript file. My goal is to have each function in a separate JavaScript file.

The problem is that a makes calls to b, and b makes calls to a, so that if I put both functions in different files, then one will be missing the definition of the other, and I get an error message and things break.

When they are in the same file, under the same closure, things don’t break because of hoisting. How can I have the two functions in different files when each references the other?

  • 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-26T05:19:01+00:00Added an answer on May 26, 2026 at 5:19 am

    If they’re going to be in different files, then you won’t have them in the same closure, so that’s the fire problem.

    After that, if you’re willing to enforce load order (i.e. load A first, the B), then simply have A define a stub of B, and then B will redefine it when it loads. As long as A doesn’t execute before B loads, you should be fine.

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

Sidebar

Related Questions

I have two controls. The XAML's are big and very similar. One difference is
I have two arrays, one is very large (more than million entries) and other
I have two big and small dataframes (actually dataset is very very big !).
We have two sets, A and B. Each one of these sets include strings.
I have two (very large) text files. What is the fastest way - in
I have two very simple, identical UITableViews in my app that are populated with
I have two question to put forward: I was very interested, even intrigued by
I have a very strange issue on my hands. I have two IIS websites
The situation is very simple, I have two panel. In the event of OnMouseOver
I'm not very good in SQL and HQL... I have two domains: class Hotel

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.