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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:26:08+00:00 2026-06-13T06:26:08+00:00

For my CSS I’m building several smaller files for specific functions and then using

  • 0

For my CSS I’m building several smaller files for specific functions and then using minification to combine and compress them into one file for download.

I would like to do the same with my JS Files – logical separation and then combine and compress with MIN for download.

The only catch I have is the AJAX based site I’m building has one core JS file that takes requests to load pages in the main viewing area.

Am I able to call this function (which is in one JS file) from other JS files? Its kind of like making one JS file public to the other scripts.

Any advice?

thx

Update******

So how would I call a function in one JS file from another.

eg:

File A has function callmetoday()

How do I call this from within JS file number 2?

  • 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-13T06:26:09+00:00Added an answer on June 13, 2026 at 6:26 am

    Yes. Unless you declare a function or variable inside a function or as an object field, it resides in the global scope. In case of a browser, that’s the window object.

    Note also the warning by Darwayne: you can only use a function from a different file after it has been declared (and in some browsers even within a file).

    Example:

    file 1.js:

    function f1(x){
      f2(x)
    }
    
    document.addEventListener("load",function(){f1(3)})
    

    file 2.js:

    function f2(x){
      alert(x)
      if(x) f1(x-1)
    }
    

    will work:

    • when 1.js is loaded, f1 appears in the global scope
    • when 2.js is loaded, f2 appears in the global scope
    • when the page is fully loaded, f1 and f2 are accessible.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

CSS and Javascript files don't change very often, so I want them to be
CSS isn't working corectly on IIS 7.5 using Helicon Zoo and Sinatra. Here is
CSS iframe { display: none; } JS $('iframe').load(function() { $('iframe').fadeIn('slow'); }); HTML <a href=http://example.com
CSS I have some simple CSS to apply a negative text-indent value on the
CSS border radius works fine, but it's now revealing a white background. (I'd prefer
CSS newbie here. Strange thing is happening, I have gaps between links, and I
CSS is not my strong suit, and I am not sure what's going on
CSS table tr {border-bottom:1px solid #008999} HTML <table width=100% cellspacing=0 cellpadding=0> <thead> <tr> <th
CSS: img{ max-height:30px; } HTML: <img src=foo.svg /> I am looking for this svg
CSS code body { background-attachment: scroll; background-clip: border-box; background-color: #ececec; background-image: none; background-origin: padding-box;

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.