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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:14:17+00:00 2026-06-17T20:14:17+00:00

I using JavaScript and wanted to ask maybe I’m not using exactly the right

  • 0

I using JavaScript and wanted to ask maybe I’m not using exactly the right way. I have ‘classes’ for example:

function Games() {
this.a='';
.
.

}

and:

functios GamesTypes() {
this.b='';
.
.

}

for each class I declare object:

var games = new Games();

A lot of times after clicking on element I need to display on the next pages the game name for example, so when user clicks on a game I setting

Games.a="game55";

and next all pages reads it and display it:

 var toDisplay = Games.a;

Is it the best thing to store some data that should be displayed in some pages?

  • 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-17T20:14:19+00:00Added an answer on June 17, 2026 at 8:14 pm

    You’re not doing bad, at least as i think.
    Just consider in JavaScript it’s not necessary to creat a “class” or a constructor function for any type of pre-set object that you may need, just using the Object native object may save you some time declaring those constructor functions.

    For example, if you need to create a new page called B that’s going to be similar to a previous one called A, and you’ve an object for A that haves all the properties and methods it needs, use B = Object.create(A) to make a new object B that will inherit all the properties and methods from A, as A would be the prototype of B.

    A simple example

    A = {
    something : value,
    someOtherThing : value,
    method : function () {
          ...
       }
    ...
    }
    B = Object.create(A); // Now B inheriths the properties and methods from A
    

    This way you don’t have to declare a constructor funciton for every type of page, just make objects inherit what they need if it’s already in another objects, and then add all the stuff to the new page. You can also override the properties that B inherited from A by just declaring them with their new value.

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

Sidebar

Related Questions

I have the following code in HTML and wanted to replace them using javascript
I am using javascript. I wanted to ask how can i pass variable link
I wanted to know if it was possible using javascript, to replace a line
I wanted to know how to send e-mail using javascript. I dont want to
Hi have a webpage which geolocates a location using javascript, i have set this
How to use Jquery if any field is being changed using javascript? I have
I've read it's not possible to read local files using Javascript without letting the
I am looking into writing web based games using just Javascript, HTML, and CSS.
I have an asp.net mvc website and am using javascript treemap control to display
I am using javascript top.location to retrieve parent location through javascript What i wanted

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.