-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mutable constants in question.js file #232
Comments
So, a common paradigm you will run into in all code, is that if a variable name is in CAPS, its a constant. Sometimes, as in this case, you could assign a value to it, and therefore mutate it, change its value. But then the stuff after it wouldn't necessarily work. So we don't do that. Did you know you can change the value of But why would you do that? I do agree with this issue in principle, and once we move to ES6, we can start doing it in practice, by using the |
Confirmed we keep as is. Yup, that's the way I've typically looked at CONSTANT declarations and have known it's a chosen syntactical format to capitalize them. Yes, if my recollection is proper, declaring a variable like |
Oh, yes, that was in Javascript of course. |
By all appearances the declared variables at the top of file question.js are intended to be CONSTANTS but are currently mutable. Recommend configuring them as immutable.
Below is the observed code:
`var CHOICE_IS_CORRECT_AND_CHOSEN = 1;
var CHOICE_IS_CORRECT_BUT_NOT_CHOSEN = 2;
var CHOICE_IS_INCORRECT_AND_CHOSEN = 3;
var CHOICE_IS_INCORRECT_AND_SEQUENCE = 4;
var CHOICE_IS_PHRASE_AND_WE_CANT_TELL_YET = 5;
var CHOICE_IS_FROM_QUESTION_TYPE_SET = 6;
var CHOICE_IS_INDETERMINEDLY_ANSWERED = -1;
var QUESTION_TYPE_SINGLE = 1;
var QUESTION_TYPE_MULTIPLE = 2;
var QUESTION_TYPE_PHRASE = 3;
var QUESTION_TYPE_SEQUENCE = 4;
var QUESTION_TYPE_SET = 5;
var UI_ID_Generator = (function() {
var my = {};
}());`
The text was updated successfully, but these errors were encountered: