About the use of double colons in javascript ::

Q

Québec

Hi,

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


Curious me...

Jean Pierre
 
T

Thomas 'PointedEars' Lahn

Québec said:
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
 
T

Thomas 'PointedEars' Lahn

[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 said:
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
 
Q

Québec

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();
 
T

Thomas 'PointedEars' Lahn

Québec said:
^^
Please repair your newsreader:
http://home.in.tum.de/~jain/software/oe-quotefix/
http://translate.google.com/transla...&hl=de&ie=UTF-8&oe=UTF-8&prev=/language_tools
I found it back. It is only a colon.

<script language="JavaScript">

Use said:
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
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top