Defining Constants

G

Gene Wirchenko

Dear JavaScripters:

I want to include some constants for use with my date type. This
is related to my question about toString() parameters.

Should I do

1) Defined in Object

function JustDate()
{
....
this.JDFmtISO8601=1;
this.JDFmtIMA=2;
....

or

2) Defined Outside Object

JDFmtISO8601=1;
JDFmtIMA=2;

function JustDate()
{
....

Does it really matter?

Sincerely,

Gene Wirchenko
 
D

Dr J R Stockton

In comp.lang.javascript message <c8nke7t4hcpkapltpsntad1d55k7le2q8u@4ax.
1) Defined in Object

function JustDate()
{
...
this.JDFmtISO8601=1;
this.JDFmtIMA=2;
...

Avoid "JD" in this context; it already has an established meaning in
connection with dates.

Consider also

var GWC = { JDFmtISO8601 : 1 , JDFmtIMA : 2 , ... }
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top