Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Defining Constants

Reply
Thread Tools

Defining Constants

 
 
Gene Wirchenko
Guest
Posts: n/a
 
      12-15-2011
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
 
Reply With Quote
 
 
 
 
Dr J R Stockton
Guest
Posts: n/a
 
      12-16-2011
In comp.lang.javascript message <c8nke7t4hcpkapltpsntad1d55k7le2q8u@4ax.
com>, Thu, 15 Dec 2011 14:42:00, Gene Wirchenko <(E-Mail Removed)> posted:

>
>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 , ... }

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
defining or not defining destructors johny smith C++ 8 07-02-2004 08:51 AM
Defining constants in classes Joe C++ 29 03-04-2004 03:03 PM
Defining a real valued input in the entity VHDL 1 02-04-2004 08:15 AM
Defining constants in global scope Thomas Sondergaard Ruby 2 09-24-2003 06:02 AM
Defining/declaring constants in Python Sriram Chadalavada Python 2 07-29-2003 11:56 AM



Advertisments