469,600 Members | 2,367 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

About the use of double colons in javascript ::

Hi,

I have seen a script using double colon in javascript. Is there
examples somewhere?
Curious me...

Jean Pierre
Jul 20 '05 #1
7 7509
In article <Ld******************@wagner.videotron.net>, "Québec" <jp**@vidn.ca>
writes:
Hi,

I have seen a script using double colon in javascript. Is there
examples somewhere?


Well, ummm, perhaps an "example" might be the one where you saw it? And maybe
even a URL to such page to see what they are using it for?
--
Randy
Jul 20 '05 #2
Québec wrote:
I have seen a script using double colon in javascript. Is there
examples somewhere?


If you provide them. So far there is no `::' operator
in the JavaScript language, not even in v2.0 with classes.
PointedEars
Jul 20 '05 #3
Québec wrote:
I have seen a script using double colon in javascript. Is there
examples somewhere?


Maybe you mean the namespace lookup operator of JavaScript 2.0
(with classes):

http://www.mozilla.org/js/language/j...html#namespace
http://www.mozilla.org/js/language/j...amespaces.html
PointedEars
Jul 20 '05 #4
Can I have a small example of this?
"Thomas 'PointedEars' Lahn" <Po*********@web.de> wrote in message
news:bp*************@ID-107532.news.uni-berlin.de...
Québec wrote:
I have seen a script using double colon in javascript. Is there
examples somewhere?


Maybe you mean the namespace lookup operator of JavaScript 2.0
(with classes):

http://www.mozilla.org/js/language/j...html#namespace
http://www.mozilla.org/js/language/j...amespaces.html
PointedEars

Jul 20 '05 #5
[Top post repaired, please take your time to read
http://www.netmeister.org/news/learn2quote.html
more throughly if you want further answers.]

Québec wrote:
"Thomas 'PointedEars' Lahn" <Po*********@web.de> wrote [...]
Québec wrote:
I have seen a script using double colon in javascript. Is there
examples somewhere?


Maybe you mean the namespace lookup operator of JavaScript 2.0 (with
classes):

http://www.mozilla.org/js/language/j...html#namespace
http://www.mozilla.org/js/language/j...amespaces.html


Can I have a small example of this?


Since *you* have seen a script using the operator, *you* are to provide the
example. And no, I cannot provide one since JavaScript 2.0 as proposed by
waldemar has only one known implementation (Epimetheus) that I do not own
yet. More, ECMAScript Edition 4 is still a proposal and work on JavaScript
2.0 is still in progress. Thus I have not written any JavaScript 2.0
program yet.

I wonder if you mix up JavaScript with C(Script) here.
PointedEars
Jul 20 '05 #6
Since *you* have seen a script using the operator, *you* are to provide the example.

I found it back. It is only a colon.

<script language="JavaScript">
<!--
V1={
x:function(){
var A=prompt('First name...','');
var B=prompt('Last name...','');
alert(A + ' ' + B)}
};
V1.x()

//-->
</script>

{ x:5 }
defines a new object with a property named x, and the value of the
property is 5. Note : only works in recent browsers.

v = { x:5 };
changes the value of v to being an object with a property x, and the
value of the property is 5.

function() { ... }
defines a function object that doesn't have a personal name.

Therefore
v = { x:function() { ... } };
changes the value of v to being an object with a property, alias method,
named x, and the value of that property is a function object that can be
called by doing
v.x();
Jul 20 '05 #7
Québec wrote:
Since *you* have seen a script using the operator, *you* are to provide the

^^
Please repair your newsreader:
http://home.in.tum.de/~jain/software/oe-quotefix/
http://translate.google.com/translat...language_tools
example.

I found it back. It is only a colon.

<script language="JavaScript">


Use <script type="text/javascript"> to write valid HTML 4.
V1={
x:function(){
var A=prompt('First name...','');
var B=prompt('Last name...','');
alert(A + ' ' + B)}
};
[...]
function() { ... }
defines a function object that doesn't have a personal name.


That is called an `anonymous function'. When you display the code
of the function, i.e. the value of the `x' property here, with IE
(6), it even shows `function anonymous() ...'.
PointedEars
Jul 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

45 posts views Thread by Edward K. Ream | last post: by
2 posts views Thread by brian | last post: by
13 posts views Thread by John | last post: by
10 posts views Thread by chanma | last post: by
9 posts views Thread by Jeremy | last post: by
6 posts views Thread by Grant Robertson | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.