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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:31:16+00:00 2026-06-09T03:31:16+00:00

What potential problem can arise if I am keeping data inside a global var

  • 0

What potential problem can arise if I am keeping data inside a global var cache = {} ?

Will it be collected by the garbage collector?
Can I ensure it’s persistent until the end of viewing?

Is there browser built-in functionality I can use so even next time opening the page I have the cached data ready?

Thanks.

  • 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-09T03:31:20+00:00Added an answer on June 9, 2026 at 3:31 am

    It sounds like you need to understand the lifetime of global data in javascript:

    1. During the lifetime of a given page, a global variable lasts until you clear it’s value. It will never be garbage collected. Because it’s global, it can never go out of scope.

    2. When the viewer goes to a new page in that window or closes that browser window, all javsacript data for that prior page is freed and is no longer available.

    3. There are three ways to persist data so it can be used in future views of that page or in other pages: 1) Cookies, 2) Local Storage, 3) Server storage. In all of these cases, the data would have to be retrieved from its storage location and put back into javascript.

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

Sidebar

Related Questions

What is a great problem I can give a couple of potential devs that
i have this problem: ms-access could not delete and i found a potential solution
I can see some potential difficulties with this concept but the idea is: I
QUESTION: How can I handle potential contention between two separate threads accessing the same
I have a problem and I have potential solution. But I wanted to confirm
I'm trying to figure out a potential solution to a future problem In my
Here's the (potential) problem: I create a COM object, and then use a 'foreach'
My specific problem is that I need to execute a (potentially) large number of
I'm working on a solution to a problem where users could potentially access images
What would a potential employer think when seeing a function such as: function updTable{$table,

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.