It's a common practice to write property name in UPPERCASE
if its value is constant.

I'm wondering if this convention also applies to property
that will remain unchanged itself, but that is going to be
overwritten upper in the prototype chain? Does such property
still fall under the definition of constant? Should I be
writing it in UPPERCASE (example 1) or in lowercase (example 2)?


Example 1
----------------------------------------

var dialog = {
  INITIAL_WIDTH: 100,
  INITIAL_HEIGHT: 100,
}

var aboutDialog = Object.create(dialog);
aboutDialog.INITIAL_WIDTH = 200;
aboutDialog.INITIAL_HEIGHT = 300;

var prefsDialog = Object.create(dialog);
prefsDialog.INITIAL_WIDTH = 700;
prefsDialog.INITIAL_HEIGHT = 500;


Example 2
----------------------------------------

var dialog = {
  initialWidth: 100,
  initialHeight: 100,
}

var aboutDialog = Object.create(dialog);
aboutDialog.initialWidth = 200;
aboutDialog.initialHeight = 300;

var prefsDialog = Object.create(dialog);
prefsDialog.initialWidth = 700;
prefsDialog.initialHeight = 500;

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to