469,270 Members | 1,163 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

define a constant in a virtual class

How is it possible to define a constant in a virtual class?

E.g. I wrote the following code

tml = {
sayHello : function()
{
alert('hello');
}
}

now if I want to add a constant into tml virtual class, what I need to
do?

I tried something like

tml = {
const1 : Integer = 0,
sayHello : function()

or

tml = {
const1 : function(){return 0;},
sayHello : function()
in both case, trying to get - inside tml object - the value of
const1 ... it results in a Object value and not the Integer value I
need.
Where am I doing mistakes?

Thanks
Andrea

Jun 8 '07 #1
4 3642
Andrew said the following on 6/8/2007 6:02 PM:
How is it possible to define a constant in a virtual class?
Javascript has no concept of what a "constant" is. What is it that you need?
Where am I doing mistakes?
const1: 0;

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 9 '07 #2
Well what I need is to a have a variable that store a value that can
be matched with another value.

According to my sample above.

tml = {
sayHello : function()
{
alert('hello');
} ,
myvalue = 0,
sayHello2 : function()
{alert (tml.myvalue)}
}

Jun 9 '07 #3
Andrew said the following on 6/9/2007 4:52 AM:
Well what I need is
<snip>

What you "need" is to quote what you are replying to so people know what
it is that you are replying to/about. You might be surprised to know how
many people ignore people who top-post, don't quote, or don't trim. It
is brutal sometimes.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 9 '07 #4
What you "need" is to quote what you are replying

I suppose the overquoting is an activity that let waste people time
and space, especially when people don't run on 48'' screen. Scroll
down the mouse along the screen and cross the eye just because read
the previous reply it's too difficult.

Quoting should be - at my advice - done when multiple reply or more
argument has given not always.
So, I appreciate your suggestion, but I think that an interesting
reply was better that read how to post.

This is an abstract of netiquette ... "When replying to a message,
include enough original material to be understood but no more.
It
is extremely bad form to simply reply to a message by including
all the previous message: edit out all the irrelevant material."

And I think that a summarize in my case wasn't needed.

Bye
Andrea

Jun 9 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Nolan Martin | last post: by
7 posts views Thread by Morgan Cheng | last post: by
4 posts views Thread by Tony Johansson | last post: by
5 posts views Thread by Paul E Collins | last post: by
2 posts views Thread by Jason | last post: by
10 posts views Thread by Dennis Jones | last post: by
8 posts views Thread by Stefano Sabatini | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.