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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:25:35+00:00 2026-06-11T18:25:35+00:00

I was interested in a really quick enumeration of constant values for a project

  • 0

I was interested in a really quick enumeration of constant values for a project I’m working on, but everything I found on StackOverflow was ridiculously over-complicated if all you want is to store several unchanging values in a single place so that you can reuse them. They also used objects, which meant you could change their values, or you had to understand and use a “freeze” keyword which may not be implemented in your browser.

Is the obvious use of closures here a bad idea? Maybe I’m using them too much, but it seems like they come in handy everywhere. Especially here.

var black = new Color3f(0, 0, 0);
var white = new Color3f(1, 1, 1);
var blue = new Color3f(0, 0, 1);

var Colors = {

    //insert basic stuff for Color3f objects here

    BLACK: function(){
        return black;
    },

    //and so on
};
  • 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-11T18:25:36+00:00Added an answer on June 11, 2026 at 6:25 pm

    No need for the extra global variables:

    var Colors = {
    
        //insert basic stuff for Color3f objects here
    
        BLACK: new Color3f(0, 0, 0),
    
        //and so on
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm really interested in the PyPy project, but for the 1st (but less well-known)
I'm really interested in participating as a new developer in an OpenSource project. My
I'm interested in doing some Java web development but I'm not really interested in
Probably a bit off topic question, but it's something I'm really interested in getting
I found this question on an online forum: Really interested on how it can
I'm really interested in Artificial Neural Networks, but I'm looking for a place to
I'm really interested in speech-to-text algorithms, but I'm not sure where to start studying
I'm really interested in trying out the Pyramid Framework but only half of my
May be this is a very basic question, but I am really interested to
probably a very beginner's question, but I'm really interested in how to make it

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.