473,503 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Array in javascript

Hi.

Is it possible in javascript to operate on an array without knowing how mamy
elements it has?
What i want to do is sending an array to a script, and this script should
add all values from that array

Could you show me a little example how to do this?

Thanks.
Leszek
Feb 2 '06
104 16851
On 2006-02-04, Randy Webb <Hi************@aol.com> wrote:
Jasen Betts said the following on 2/3/2006 4:48 AM:
On 2006-02-02, Leszek <le*******@poczta.onet.pl> wrote:
Hi.

Is it possible in javascript to operate on an array without knowing how mamy
elements it has?
No it is not because all arrays have a length property which tells you how
many elements they have :)


You sure about that?


That was indeed my intent.
<script type="text/javascript">
var myArray = new Array()
myArray['myArrayElement'] = 'something'
alert(myArray.length)
</script>


you are giving the array a property, not an element.

--

Bye.
Jasen
Feb 5 '06 #51
JRS: In article <11**********************@f14g2000cwb.googlegroups .com>
, dated Sat, 4 Feb 2006 14:34:09 remote, seen in
news:comp.lang.javascript, VK <sc**********@yahoo.com> posted :

Dr John Stockton wrote:
var A = []
A[99999] = 9
L = A.length // 100000
N = 0
for (J in A) N++ // 1

The validity of the *last* of those statements implies that the answer
to the question is "Yes".
"Yes" if you are using Array as Array and do not use it as hashtable
*and* as array *at the same time*.


An Array is an Array, no matter how it is used.
<http://www.geocities.com/schools_ring/ArrayAndHash.html>
Section "Array as hash" explains it in details.
Detail is all very well; but correctness is more important.
P.S.
var A = new Function();
A[0] = 1;
A[9999] = 2;
for (var p in A) {alert(p);}
Without knowing what you think that shows, meaningful comment is not
possible.
but not everything one can
do one *should* do, especially if the core matter is not clearly
understood.


That includes writing about the matter. You should follow your own
advice in that particular case, although not, of course, in general.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Feb 5 '06 #52
JRS: In article <11*********************@f14g2000cwb.googlegroups. com>,
dated Sat, 4 Feb 2006 12:18:11 remote, seen in
news:comp.lang.javascript, VK <sc**********@yahoo.com> posted :

I repeat my very first statement: "JavaScript Array is dynamic, jagged,
sparse"


Since you have a weak understanding of both javascript and English, you
should not pontificate on terminology. You should not even copy
material read elsewhere, since you lack the capability of evaluating its
soundness.

You should concentrate first on learning English (it seems not to be
taught well in your country) and then on understanding javascript.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Feb 5 '06 #53
VK wrote:
Randy Webb wrote:
Let me know when you figure out that there is no
multi-dimensional array in JS.
The whole branch of this thread was that JavaScript array is
*not* multi-dimensional, they are *jagged*. These are two
different categories, and I continuosly stated that JavaScript
array is jagged (see my very first post), not multi-dimensional.


So you cannot see that jaggedness pre-supposes multi-dimensionality? If
you deny multi-dimensionality you preclude jaggedness. But as I have
said, the only sense in which a single javascript Array can appear
multi-dimensional is when it forms an array of arrays where all the
array references refer to the same single array, and that structure
precludes jaggedness. So either a javascript Array is not
multi-dimensional and so jaggedness is precluded, or you accept the
single apparently multi-dimensional exception and still preclude
jaggedness.
- A is true
- OK, then come back when you understand that A is true

? Who's out of loop here? :-0

I repeat my very first statement: "JavaScript Array is
dynamic, jagged, sparse"
Repeating something does not make it true.
I do not require that everyone in this group will understand
this definition as it requires rather good and specific
programming knowledge.
Clearly your understanding does not require a good and specific
programming knowledge; it requires and inability to comprehend logic and
a stubborn refusal to perceive personal inadequacies.
But the fact if some term is not known to me doesn't mean
that the term is wrong or doesn't have sense. It just means that I
don't know something as well as I would like to, is not it?

<quote>
We are using the term "jagged array" to describe a
multi-dimensional array that is not necessarily rectangular. ...
</quote>
A javascript Array is not a multi-dimensional array that is not
necessarily rectangular.
<quote>
The jagged array is basically an array of arrays. ...
</quote>
A javascript Array is not an array of arrays.
These are quotes from works published on MIT.edu but I do
*not* want to place them as official references until some
more answers I'm waiting for.
All you are doing is quoting (and without citing0 statements that say
that things that are jagged are not javascript arrays. If you want to
make a credible point here you need to be presenting something that is a
single javascript Array and that exhibits jaggedness.
It's just to explain again what I (and real programmers where
I'm not part of) do mean by saying "jagged array".
And so far they appear to mean exclusively things that are not a single
javascript array.
It is cristal clear to
anyone why JavaScript array is jagged
Absolutely the reverse. It is crystal clear to everyone except you that
a single javascript Array is completely incapable of exhibiting anything
that might reasonably be described as jaggedness, and so that javascript
arrays are not jagged.
and no one ever tried to dismiss it until this very thread.
As Randy said, to date nobody has been irrational enough to propose that
javascript Arrays are jagged.
I'm not sure what your problem is, guys,
We prefer comp.lang.javascirpt to be a source of information about
javascript not of bizarre, uninformed, irrational and false fantasies
about javascript.
but I'm still willing to help,
Your only possibility is to help yourself, by accepting that the process
that you are applying to your understanding of javascript is so
critically flawed that you know next to nothing now, and less and less
as you attempt to 'study' the subject. You need to significantly change
something before you can even hope to stop being a liability.
this is why I will bring more 3rd party
explanations and samples later as promised.


Any number of statements that things that are not javascript Arrays
exhibit jaggedness will not impact the nature of a javascript Array.
They would be a waste of everyone's time.

You either can demonstrate a single javascript Array exhibiting
'jaggedness' or you are wrong, end of story.

Richard.
Feb 5 '06 #54
VK wrote:
Randy Webb wrote: <snip>
To date, most of your points of view with regards to Array's
has been dead wrong. The funny part is watching you trying to
defend that position.


It was confirmed by many, including professional programmers
and programming specialists.


In its current form the second block of text on your page at:-

<http://www.geocities.com/schools_ring/ArrayAndHash.html>

- (under the title "Array and Hash in JavaScript") reads:-

| You can use a notation like arrayObject[-1] to address the last
| element in the array, but it's not a negative index: it's just
| a shortcut of arrayObject[arrayObject.length-1]

- and that statement is false. It is not a question of interpretation or
implementation vagaries, it is simple a statement that is unambiguously
and objectively false. The language specification says that this must
never be true in any ECMAScript implementation, it is not true in any
implementation, and you can see that it is not true by doing no more
than trying it.

No you might feel reassured to find your "points of view with regards to
Array's" "confirmed by many, including professional programmers and
programming specialists" but when those views include the objectively
false it should be obvious that these confirmations are worthless.
As it brings them automatically to the category of "people
who knows no more or even less than VK does"

<snip>

Whether these "programming specialists" know more or less than you (or
both?) is irrelevant; if they are confirming statements about javascript
Arrays that are objectively false their opinions about javascript arrays
are worthless.

Richard.
Feb 5 '06 #55
VK

Dr John Stockton wrote:
Since you have a weak understanding of both javascript and English, you
should not pontificate on terminology. You should not even copy
material read elsewhere, since you lack the capability of evaluating its
soundness.

You should concentrate first on learning English (it seems not to be
taught well in your country) and then on understanding javascript.


Dear Doc,
As it was pointed out already in this thread that you're trying to
participate in a topic which is beyond of your current knowledge. That
was already clearly demostrated by some "advises" you've posted. Please
care to learn the basics before making some global statements.
Respectfully,

.... aka VK

Feb 5 '06 #56
VK said the following on 2/3/2006 1:14 PM:
my question would be what authority besides Richard Cornford would you
accept as an authority?


After just reading your reply to me in another thread, it made me think
about this again and I will give you one more to bookmark, fair enough?

If Richard Cornford, or anybody else for that matter, were to post here
and say that JS has any of the following three things:

1)"multi-dimensional arrays" (which it doesn't)
2)"jagged array" (which it doesn't)
3)"hash array" (which it doesn't)

Then if I am not the first one then I will get in line to tell them they
are wrong.

I will even say that Richard's test code for a multi-dimensional array
doesn't fit the definition I gave you:

<quote>
Create a multi-dimensional array in JS where no element in that array is
an array.

If JS truly supports multi-dimensional arrays then you should have no
problem creating one for me without making any element in it an array.
And not even Richards example meets that requirement.
</quote>

The only thing that will *ever* change that is if the JS engines are
changed to support them.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 6 '06 #57
VK

Randy Webb wrote:
After just reading your reply to me in another thread, it made me think
about this again and I will give you one more to bookmark, fair enough?

If Richard Cornford, or anybody else for that matter, were to post here
and say that JS has any of the following three things:

1)"multi-dimensional arrays" (which it doesn't)
True
2)"jagged array" (which it doesn't)
Wrong
3)"hash array" (which it doesn't)


Wrong (besides there is not "hash array" as a proper term. One should
say "associative array", "hashtable" or "hash")

Let's stop on the first wrong. You are still i) refusing to read the
definition ii) thinking of a particular array instead of the model.

var myArray = new Array();
myArray[0] = new Array(1,2,3,4);
myArray[1] = new Array(1,2,3);
myArray[2] = new Array(1,2);
myArray[3] = new Array(1,2,3,4);

myArray is a sigle-dimension array. But it has other arrays as its
elements. In the programming it is called "jagged array". I
intentionally took different size arrays to show why the word "jagged"
had been chosen. It again doesn't imply that internal arrays *have* to
be of different size. They can perfectly be of the same size. It's
again not a description of a particular instance, but abstract model
thinking: this kind of array *can* be jagged, so it is always called
"jagged" to destinguish from "multi-dimensional" array which cannot be
jagged.

You are welcome to print out myArray sample and go across the world
(both European and American institutes are welcome) asking for
definition and explanation. It will be the same I just gave you.

Feb 7 '06 #58
VK wrote:
Randy Webb wrote:
After just reading your reply to me in another thread, it made me think
about this again and I will give you one more to bookmark, fair enough?

If Richard Cornford, or anybody else for that matter, were to post here
and say that JS has any of the following three things:
[...]
2)"jagged array" (which it doesn't)


Wrong


AIUI jagged arrays are possible with ECMAScript implementations, however
it is incorrect to say that ECMAScript-conforming arrays "are jagged" (by
default) as you do:

,-<URL:http://en.wikipedia.org/wiki/Jagged_array>
|
| [...]
| Arrays of arrays, on the other hand, allow the creation of ragged arrays,
| also called jagged arrays, in which the valid range of one index depends
| on the value of another, or in this case, simply that different rows can
| be different sizes.

Just to quote some of the top Google hits for "jagged array":

,-<URL:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfjaggedarrays.asp>
|
| A jagged array is an array whose elements are arrays. The elements of a
| jagged array can be of different dimensions and sizes. A jagged array is
| sometimes called an "array-of-arrays."

,-<URL:http://www.startvbdotnet.com/language/arrays.aspx>
|
| Jagged Arrays
|
| Another type of multidimensional array, Jagged Array, is an array of
| arrays in which the length of each array can differ. Example where this
| array can be used is to create a table in which the number of columns
| differ in each row. Say, if row1 has 3 columns, row2 has 3 columns then
| row3 can have 4 columns, row4 can have 5 columns and so on.

,-<URL:http://www.geekpedia.com/tutorial78_Jagged-arrays.html>
|
| They say a jagged array is an array of arrays.
3)"hash array" (which it doesn't)


Wrong (besides there is not "hash array" as a proper term. One should
say "associative array", "hashtable" or "hash")


No, one should not. For that would mean that such properties become part of
the encapsulated array data structure, that they are exposed as elements of
the array, which they are not (the Array object's `length' property makes
that perfectly clear). They are only properties of the encapsulating Array
object, which is a different thing.
PointedEars
Feb 7 '06 #59
VK
Thomas 'PointedEars' Lahn wrote:
3)"hash array" (which it doesn't)


Wrong (besides there is not "hash array" as a proper term. One should
say "associative array", "hashtable" or "hash")


No, one should not. For that would mean that such properties become part of
the encapsulated array data structure, that they are exposed as elements of
the array, which they are not (the Array object's `length' property makes
that perfectly clear). They are only properties of the encapsulating Array
object, which is a different thing.

My "wrong" about "hash array" was in reply to:
...
3)"hash array" (which it doesn't)
...
where I took "it" as a reference to "JavaScript", so "JavaScript
doesn't have hash array", something like that. It is difficult
sometimes to keep the thread of discussion when your opponents are
ready to bring X amount of side topics as soon as they are losing on
the main one. :-) Actually you know that, do you? ;-))

Feb 7 '06 #60
VK wrote:
Randy Webb wrote: <snip>
... and say that JS has any of the following three things:

1)"multi-dimensional arrays" (which it doesn't)


True
2)"jagged array" (which it doesn't)


Wrong
3)"hash array" (which it doesn't)


Wrong


It has been observed that javascript should theoretically be capable of
emulating anything. A reasonable criteria for deciding whether a
language that can emulate anything "has" something specific might be to
examine how that something could be achieved with the language and
distinguish between the things that need to be emulated and those that
do not. With the things that do not need to be emulated being the things
that the language does "have".

None of the items listed above can be employed in javascript without
code being authored in order to emulate them. So javascript does not
"have" any of them.
(besides there is not "hash array" as a proper term.
It is a bit hypocritical of you to quibbling about terms when you more
often as not use terms in a way that is unique to you.
One should say "associative array", "hashtable" or "hash")
But one should only use those terms when referring the three distinct
things that are associative arrays, hashtables and hashes. They are
certainly not interchangeable terms for the same thing, and arguably
inapplicable to any native feature of the javascript language.
Let's stop on the first wrong.
Yes lets. The initial wrong statement you made, and repeated, was:-

| I repeat my very first statement: "JavaScript Array is
| dynamic, jagged, sparse"

There is no question that the javascript Array is dynamic. You can add,
remove and assign new values to the properties of a javascript Array at
any time. All javascript arrays exhibit dynamicness, it is a fundamental
characteristic of the javascript array.

There is no question that the javascript Array is a sparse array. Even
javascript Array instances that are not sparse themselves can be
rendered sparse by deleting some of their 'array index' properties or
assigning bigger values to their - length - property. All javascript
Arrays are capable of exhibiting sparseness, it is a fundamental
characteristic of all javascript Arrays.

But 'jagged' is not an appropriate characteristic to apply to the
javascript array. It is logically impossible for a javascript Array to
exhibit jaggedness, it is _not_ a characteristic of the javascript
array at all.
You are still i) refusing to read the definition
The definition of what exactly? Would that have been the definitions of
a 'jagged array' that you posted without stating their sources? The
first read:-

| <quote>
| We are using the term "jagged array" to describe a
| multi-dimensional array that is not necessarily rectangular.
| ...

- with a rather contradictory second alternative reading:-

| <quote>
| The jagged array is basically an array of arrays.
| ...

Obviously as javascript Arrays only have a single dimension that first
definition effectively says that a javascript Array is not a 'jagged
array', and as a javascript Array is not an array or array the second
definition states that a javascript array is not a 'jagged array'. So
under those circumstances it is difficult to see what relevance these
definitions have to the question in hand, except to reinforce the
conclusion that it is incorrect to characterise the javascript Array as
'jagged'. A conclusion that requires no reinforcement as it is a logical
consequence of a true statement about javascript, therefor itself true.
ii) thinking of a particular array instead of the model.
If you want to make a statement about the nature of the javascript Array
the inability to show any javascript array instances exhibiting
jaggedness is a telling factor in deciding whether jaggedness is a
characteristic of the javascript Array. Saying that no javascript Array
instance exhibits jaggedness is not "thinking of a particular array", it
is a general statement about javascript Arrays.
var myArray = new Array();
myArray[0] = new Array(1,2,3,4);
myArray[1] = new Array(1,2,3);
myArray[2] = new Array(1,2);
myArray[3] = new Array(1,2,3,4);

myArray is a sigle-dimension array.
As are all javascript Arrays.
But it has other arrays as its elements.
It certainly does. The structure created here is an array of arrays.
In the programming it is called "jagged array".
It corresponds with your second quoted definition of a 'jagged array',
and contradicts the first as it is not a multi-dimensional array (except
as an emulation of the multi-dimension concept executed with javascript;
an array of arrays).
I intentionally took different size arrays to show why
the word "jagged" had been chosen.
Redundant as that has not been significantly disputed.
It again doesn't imply that internal arrays *have* to
be of different size.
They do if you want to call this a 'jagged array'.
They can perfectly be of the same size.
If they were the same size your could only call this a multi-dimensional
array (as that would be the concept that would be being implemented in
that case, there would be no jaggedness to justify the term 'jagged
array').
It's again not a description of a particular
instance, but abstract model
No that is a particular instance. It is an instance of something that
implements the concept of a 'jagged array' as described by the second of
your quoted definitions.
thinking: this kind of array *can* be jagged, so it is always
called "jagged" to destinguish from "multi-dimensional" array
which cannot be jagged.
On the contrary, a 'jagged array' must be a multi-dimensional array. The
first of your quoted definitions stated as much, and the emulation of a
multi-dimensional array in javascript is just as much an array of arrays
as your example of an emulation of a jagged array. The jaggedness of a
jagged array follows from the non-rectangularness of a multi-dimensional
array. With a single dimension there would not be the variation that is
described a jagged, and indeed there would be nothing else to have
variation between.
You are welcome to print out myArray sample and go
across the world (both European and American institutes
are welcome) asking for definition and explanation. It
will be the same I just gave you.


Your code is already understood, it is just irrelevant to the question
at hand. It is irrelevant because a javascript Array is not an array of
arrays. Choosing to call a particular form of an array of arrays a
'jagged array' does not imply anything about things that are not arrays
of arrays, and the javascript array is not an array of arrays.

The only justification that can be made for "JavaScript Array is
dynamic, jagged, sparse" is to show a (any) javascript Array instance
exhibiting jaggedness (which is a proven impossibility). You can either
do that or your characterisation of javascript Arrays is just false.

Richard.
Feb 8 '06 #61
VK wrote:
[snip]
Let's stop on the first wrong. You are still i) refusing to read the
definition ii) thinking of a particular array instead of the model.

var myArray = new Array();
myArray[0] = new Array(1,2,3,4);
myArray[1] = new Array(1,2,3);
myArray[2] = new Array(1,2);
myArray[3] = new Array(1,2,3,4);
It is is you who are refusing to read the spec and are thinking about a
particular array "myArray."
myArray is a sigle-dimension array. But it has other arrays as its
elements. In the programming it is called "jagged array".
Array of arrays is more descriptive and accurate terminology. But you
are free to call it whatever you like. Why not just continue with your
own naming scheme and call it a "Psi-array."
I intentionally took different size arrays to show why the word "jagged"
had been chosen.
In your example myArray is an array with a length of 4. Each element
contains exactly 1 value. That sounds "rectangular" and "uniform" to
me. Would this array be jagged?

var myArray = ['a', 'abcde', 'abc', 'ab'];

Each element has a different length, so it must be "jagged."
It again doesn't imply that internal arrays *have* to
be of different size. They can perfectly be of the same size. It's
again not a description of a particular instance, but abstract model
thinking:
Translate "abstract model thinking" to "VK deranged thinking." Herein
lies the root of the problem. Your "thinking" and most other people's
thinking rarely agree.
this kind of array *can* be jagged, so it is always called
"jagged" to destinguish from "multi-dimensional" array which cannot be
jagged.
Javascript has neither m-d nor "jagged" arrays. They can only be
emulated. In your mind you are free to call these emulated constructs
anything you want but that does not mean that javascript natively "has"
these types of constructs.
You are welcome to print out myArray sample and go across the world
(both European and American institutes are welcome) asking for
definition and explanation. It will be the same I just gave you.


I would be very disappointed if I did not get the "array of arrays"
definition in greater quantity than the psi-array definition.
(Unfortunately, this thread (on developersdex.com) is now the top
search result on Google when searching for (javascript "jagged array")
<url:http://www.google.com/search?q=javascript+%22jagged+array%22> so I
fear more people may be exposed to your "abstract model thinking."

Feb 8 '06 #62
VK

Jambalaya wrote:
I would be very disappointed if I did not get the "array of arrays"
definition in greater quantity than the psi-array definition.
(Unfortunately, this thread (on developersdex.com) is now the top
search result on Google when searching for (javascript "jagged array")
<url:http://www.google.com/search?q=javascript+%22jagged+array%22> so I
fear more people may be exposed to your "abstract model thinking."


And it's great - rather than they read your ... stuff... about
"jaggedness" of single-dimension array containing strings of different
length.

Sure MIT, UC Universities, Microsoft engineers and many others stayed
for years in the dark until Jambalaya brought some light to the
humanity. Sorry for irritation but I hate when someone with no clue on
the matter doesn't hesitate to pull a bunch of proprietary crap freshly
digged from his nose. Sorry.

At least Richard stays for the things he studied *to the deep* himself.
If some conclusions got wrong it's a subject to discuss and correct (if
the willingness is presented). But at least he knows exactly why his
point is right - even if it's really wrong.

FYI: *no one* of terms I used in this thread is coined by myself. I'm
using only terms which are officially accepted in the programming. And
if "jagged array" was used to get Master of Science in MIT then I
humbly suppose that it *is* officially accepted. If "jagged" sounds not
descriptive enough or too slangish it is just too bad. I possibly would
coin something else: but the train is already gone.

Feb 8 '06 #63
VK said the following on 2/7/2006 3:02 AM:
Randy Webb wrote:
After just reading your reply to me in another thread, it made me think
about this again and I will give you one more to bookmark, fair enough?

If Richard Cornford, or anybody else for that matter, were to post here
and say that JS has any of the following three things:

1)"multi-dimensional arrays" (which it doesn't)
True
2)"jagged array" (which it doesn't)


Wrong


Wrong VK, even by your very own definition.
3)"hash array" (which it doesn't)


Wrong (besides there is not "hash array" as a proper term. One should
say "associative array", "hashtable" or "hash")


And the same can be said for your "jagged array" then. But in either
event, JS doesn't possess a "hash array", an "associative array" a
"hashtable" nor a "hash".
Let's stop on the first wrong. You are still i) refusing to read the
definition ii) thinking of a particular array instead of the model.

var myArray = new Array();
myArray[0] = new Array(1,2,3,4);
myArray[1] = new Array(1,2,3);
myArray[2] = new Array(1,2);
myArray[3] = new Array(1,2,3,4);

myArray is a sigle-dimension array. But it has other arrays as its
elements.
That makes it an "array of arrays" and your very first definition of a
"jagged array" that you quoted said a jagged array was a
multi-dimensional array. Which is it? An array of arrays or a
multi-dimensional array?

But, myArray is linear and a linear array can not be jagged.
In the programming it is called "jagged array".
In *most* programming languages it may be, but not in Javascript my
friend. You are welcome to come up with an MSDN, A Devedge, or an ECMA
page to show me differently though.
I intentionally took different size arrays to show why the word "jagged"
had been chosen.
I already knew what it was called "jagged" and to display "jagged"
behavior, to me, it has to be multi-dimensional which JS can't have.
It again doesn't imply that internal arrays *have* to
be of different size. They can perfectly be of the same size. It's
again not a description of a particular instance, but abstract model
thinking: this kind of array *can* be jagged, so it is always called
"jagged" to destinguish from "multi-dimensional" array which cannot be
jagged.

You are welcome to print out myArray sample and go across the world
(both European and American institutes are welcome) asking for
definition and explanation. It will be the same I just gave you.


The best Javascript writers on the planet post here. Hands down. Does it
not make you wonder why nobody but VK thinks that JS has a jagged array?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 9 '06 #64
VK

Randy Webb wrote:
The best Javascript writers on the planet post here.
A bit too loud to say maybe, but let's us assume it's true :-)
Hands down. Does it
not make you wonder why nobody but VK thinks that JS has a jagged array?


Because VK is up to date the best specialist of *JavaScript arrays* on
the planet (if we decided do go by loud definitions).

btw in the reality it's just the opposite: currently Randy and Robert
are the only known people on the planet denying that JavaScript array
is jagged. (I'm not counting few amateurs posted here just for the hell
of nastiness).

Feb 9 '06 #65
VK wrote:
[...]

FYI: *no one* of terms I used in this thread is coined by myself. I'm
using only terms which are officially accepted in the programming. And
if "jagged array" was used to get Master of Science in MIT then I
humbly suppose that it *is* officially accepted. If "jagged" sounds not
descriptive enough or too slangish it is just too bad. I possibly would
coin something else: but the train is already gone.


No one is disputing what is meant by the term "jagged array is", but
that there is no such native JavaScript object.

Sure you can create an array of arrays using JavaScript Array objects
which emulates a multi-dimensional array that might also be jagged: but
that does not mean JavaScript Arrays are jagged.

Indeed, since they are one-dimensional, they can't possibly be jagged by
your own definition (otherwise you wouldn't need to use an array of
JavaScript Array objects to emulate jaggedness).
--
Rob
Feb 9 '06 #66
Richard Cornford wrote:
Richard Cornford wrote:
<snip>
The javascript array has no potential to have multiple
dimensions and so no potential to be 'jagged'. ...


<snip>

As it happens it has just occurred to me that the concept of a
multi-dimensional array can be implemented with a single javascript
Array:-

var a = [];

for(var c = 0;c < 10;++c){
a[c] = a;
}

- The result is a single array that emulates an array with infinite
dimensions. I.E. you can stick as many sets of square brackets and valid
array indexes after the array's Identifier as you want:-

var y = a[0][0][0][0][0][0][0][0][0][0] ... [0][0][0][0][0];

- and still get a valid result from the evaluation of the property
accessor. The resulting object is of course utterly useless as an array,
it will be broken by any attempt to store anything in it, and it is not
(and could not be) 'jagged'. But utterly useless as the result may be it
is one, and the only one, way that a single javascript array can appear
to be multi-dimensional.


I believe such a case is frequently called the 'trivial solution'. :-)

Maybe it should be called the 'Oozle Woozle Array' after the mythical
Oozle Woozle Bird - so long and thanks for the giggle!
--
Rob
Feb 9 '06 #67
VK wrote:
Randy Webb wrote:
The best Javascript writers on the planet post here.
A bit too loud to say maybe, but let's us assume it's true :-)
Hands down. Does it not make you wonder why nobody
but VK thinks that JS has a jagged array?


Because VK is up to date the best specialist of *JavaScript
arrays* on the planet (if we decided do go by loud
definitions).


In your page at:-

<http://www.geocities.com/schools_ring/ArrayAndHash.html>

- (under the title "Array and Hash in JavaScript") your wrote:-

| You can use a notation like arrayObject[-1] to address the last
| element in the array, but it's not a negative index: it's just
| a shortcut of arrayObject[arrayObject.length-1]

- That statement is objectively false, and can be seen to be false by
doing no more than trying it. It is not credible to suppose that the
"best specialist of *JavaScript arrays* on the planet" would make (and
be publishing) statements that are so unambiguously false. In reality
your understanding of javascript arrays is poor; a cloud of superficial
perceptions, misconceptions, irrelevant associations and falsehoods.

The main factor standing in the way of your achieving any real
understanding of the subject is your absolute conviction that you alone
are right and everyone else wrong. A belief that is not even undermined
when it is made clear to you that your are (repeatedly) making false
stamens about javascript generally and javascript arrays in particular.
That, combined with your inability to understand and employ logic, is
more suggestive of mental illness than it is of expertise.
btw in the reality it's just the opposite: currently Randy
and Robert are the only known people on the planet denying
that JavaScript array is jagged.
When did the absence of people actively denying something make it true?
It has been a vary long time since anyone bothered to deny that the sun
goes around the earth, that doesn't mean it does.

Is it really necessary for every contributor to the group to line up and
explicitly tell you that your are wrong? In reality their silence in
response to the posts that are disagreeing with your position is a
statement of the general position. Everyone knows that you are wrong,
and is probably finding it difficult to understand why you are incapable
of seeing that.
(I'm not counting few amateurs posted here just for the
hell of nastiness).


So you can post a mixture of lies and nonsense to Usenet but want to
label others 'amateurs'? Remember that over the last month you have
asserted that a method call must be written on a single line of source
code, used a - return null; - statement in a function that could only be
meaningfully used as a constructor and written - void - as the leftmost
token in an expression statement. Your javascript understanding is poor,
and your application of it is amateurish.

Richard.
Feb 9 '06 #68
VK

Richard Cornford wrote:
In your page at:-

<http://www.geocities.com/schools_ring/ArrayAndHash.html>

- (under the title "Array and Hash in JavaScript") your wrote:-

| You can use a notation like arrayObject[-1] to address the last
| element in the array, but it's not a negative index: it's just
| a shortcut of arrayObject[arrayObject.length-1]


You must be using an outdated copy of my article. The quoted statement
has been made in the version 2.0 ( July 2005 ). It was pointed out by
Lasse Reichstein Nielsen and same day (July 07 2005) corrected. See
details at:
<http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/c12423afa53a28f8/5d5d9f14b0ba09c9#5d5d9f14b0ba09c9>

Indeed "negative index shorcut" is allowed only in array methods (like
slice and splice) but not for addressing elements in the array itself.

Everyone can make a mistake - the task to correct it in a timely
manner. :-)

To make sure that your knowledge about JavaScript arrays is correct,
always use the *official* version of "Array and Hash" article:

<http://www.geocities.com/schools_ring/ArrayAndHash.html>

Feb 9 '06 #69
VK said the following on 2/9/2006 2:18 AM:
Randy Webb wrote:
The best Javascript writers on the planet post here.
A bit too loud to say maybe, but let's us assume it's true :-)


It is, even if you don't admit it.
Hands down. Does it
not make you wonder why nobody but VK thinks that JS has a jagged array?


Because VK is up to date the best specialist of *JavaScript arrays* on
the planet (if we decided do go by loud definitions).


I want some of what ever you are smoking because it is some good stuff man.

But please tell me, oh great Javascript Array specialist that you claim
to be, how can something that is linear in form be "jagged"? Even your
own quotes (that you have refused, to date, to give URL's to) don't even
agree on what a jagged array is. Thomas gave you the best resources you
could possibly have used in your defense but you missed them.
btw in the reality it's just the opposite: currently Randy and Robert
are the only known people on the planet denying that JavaScript array
is jagged. (I'm not counting few amateurs posted here just for the hell
of nastiness).


Here's your chance then, oh "Great Javascript Array Guru" that you
portray yourself as. Please answer a question for me? It shouldn't be
too hard for you since you claim to be the best JS Array specialist around:

Question:
Why does Richard's code *not* qualify as a multi-dimensional array?

If you are so great, that should take you about .00000000002 seconds to
answer.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 9 '06 #70
VK

Randy Webb wrote:
I want some of what ever you are smoking because it is some good stuff man.
Only natural stuff man: a bit of beer and 40 (and counting) posts in
the row from frequent posters like in this thread. LSD takes a rest
after that.

But please tell me, oh great Javascript Array specialist that you claim
to be, how can something that is linear in form be "jagged"? Even your
own quotes (that you have refused, to date, to give URL's to) don't even
agree on what a jagged array is. Thomas gave you the best resources you
could possibly have used in your defense but you missed them.
Nothing helpful I can do for you besides copy my sample again:

var myArray = new Array();
myArray[0] = new Array(1,2,3,4);
myArray[1] = new Array(1,2,3);
myArray[2] = new Array(1,2);
myArray[3] = new Array(1,2,3,4);

Maybe it will be a bit more visual:

var myArray = [
[1,2,3,4],
[1,2,3],
[1.2],
[1,2,3,4]
];

If you still do not see why the term "jagged" has been coined then I'm
really out of further ideas. That maybe not the best term to use, but
not always the best terms are going into programming vocabulary.

To foreign readers:
jagged
1. raggedly notched; sharply irregular on the surface or at the
borders.
(Random House Webster, 1998, New York)

To British readers:
The word "jagged" in the above indicated meaning is first registered
in English manuscripts at the beginning of XV century.
(In case if someone thinks of it as a yaky Americanism)
Here's your chance then, oh "Great Javascript Array Guru" that you
portray yourself as. Please answer a question for me? It shouldn't be
too hard for you since you claim to be the best JS Array specialist around:

Question:
Why does Richard's code *not* qualify as a multi-dimensional array?

If you are so great, that should take you about .00000000002 seconds to
answer.


Maybe not so quick - my neuron signals are not going so quick (speed of
light limitation, damn it), plus give me a break for typing :-)

Actually it was already answered right away why it is *not*
multi-dimensional array. But as I got more experience in having a
discussion with you, I'm not failing on this trick again. First of all,
dear Sir, you have to find out what *is* multi-dimensional array and
paste (or link) a working sample of multi-dimensional array, say
VBScript, C#, C++ or Java. And this has to come not from your own mind
or a freshly updated wiki article, but *at least* from an engine
producer page or (best of all) from some reputable higher education
establishment.

Asking for definition while refusing to disclose your own one (so you
can always say: "That's not one!") *was* a great trick, but it is
currently explored to the end - with me at least.

Feb 9 '06 #71
VK wrote:
Richard Cornford wrote:
In your page at:-

<http://www.geocities.com/schools_ring/ArrayAndHash.html>

- (under the title "Array and Hash in JavaScript") your
wrote:-

| You can use a notation like arrayObject[-1] to address
| the last element in the array, but it's not a negative
| index: it's just a shortcut of
| arrayObject[arrayObject.length-1]
You must be using an outdated copy of my article. The quoted
statement has been made in the version 2.0 ( July 2005 ).


I accessed your page with that content on 2006-02-04, I would not have
quoted it if I had not first verified the current state of the page.
Claiming that you fixed it 6 months ago is not credible as there is no
way that an HTTP cache stored and delivered a 6 month old version of
such an obscure page.

I noticed when I looked at that page that about 50% of the contend had
disappeared since the last time I looked at your page, so the content
was significantly less false than the original. There isn't going to be
a great deal left once you have removed the remaining irrelevancies,
misconceptions and falsehoods. ;)

<snip> Everyone can make a mistake - the task to correct it
in a timely manner. :-)
Everyone can make mistakes, it takes a fool to repeat them.
To make sure that your knowledge about JavaScript arrays
is correct,
There is nothing that you could teach me about javascript arrays, and
your page is more likely to promoted confusion and misunderstanding than
knowledge.
always use the *official* version of "Array
and Hash" article:

<snip>

So have you changed the title?

Richard.
Feb 9 '06 #72
VK

Richard Cornford wrote:
I accessed your page with that content on 2006-02-04, I would not have
quoted it if I had not first verified the current state of the page.
Are you publically accusing me in cheating? That's not nice of you. The
relevant paragraph has been corrected July 7 2005. You could not get
not-corrected variant as of 2006-02-04 unless something is deeply wrong
with your server cach.
Claiming that you fixed it 6 months ago is not credible as there is no
way that an HTTP cache stored and delivered a 6 month old version of
such an obscure page.
<http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/c12423afa53a28f8/5d5d9f14b0ba09c9#5d5d9f14b0ba09c9>
Jul 7 2005, 3:36 pm
Lasse Reichstein Nielsen wrote: Comment: "You can use a notation like arrayObject[-1] top address the
last element in the array". Nope, doesn't work. It merely tries to
access the property named "-1", which doesn't exist unless you created
it.


VK:
My bad! Did not check it for addressing option. Changed to:

Although in array methods you may refer the last array element using
-1, it's not a negative index, it's just a shortcut: for instance
arrayObject.slice(10,-1) simply means
arrayObject.slice(10,arrayObject.length-1)

P.S. Richard, that's getting too low for a *discussion*. Should we take
a coffee break for a day or two to let emotions out?

Feb 9 '06 #73
VK wrote:
Randy Webb wrote: <snip>
But please tell me, oh great Javascript Array specialist
that you claim to be, how can something that is linear
in form be "jagged"? <snip>
Nothing helpful I can do for you besides copy my sample
again:

var myArray = new Array(); <snip; irrelevance> ];

If you still do not see why the term "jagged" has been
coined then I'm really out of further ideas.
The reason for using the term 'jagged' (or the alternative 'ragged') has
never been questioned. This thread exists because when you said (and
repeated) "JavaScript Array is dynamic, jagged, sparse" you were
applying the term 'jagged' to something that is incapable of exhibiting
jaggedness; the javascript Array.

No amount of definitions of a 'jagged array' that effectively state that
a jagged array is something that a javascript Array is not will make the
term applicable to a javascript Array. And no number of examples of code
that can be described as a 'jagged array' but represent structures that
are not a javascript Array will convince anyone (except you) either.
Most people don't make the mistake of trying to transfer the qualities
of a construction onto its component parts.

Consider the implications of this notion of transferring a label for a
structure (no matter how appropriate that label may appear for that
structure) to its building blocks. By analogy, and using an archetypal
building block; the house brick: A house brick might be characterised as
'a normally rectangular block of ceramic', and it may be used to build
various sorts of structures, one of which might be appropriately
labelled 'a perimeter barrier around a property' (i.e. a garden wall).

The same logic that labels an array of arrays as a 'jagged array' and
then uses that to justify 'jagged' in "JavaScript Array is dynamic,
jagged, sparse" would also have a house brick characterised as 'a
normally rectangular block of ceramic, a perimeter barrier around
property'. This is not sound reasoning. When component parts are
distinct form the construction the ability to make the construction does
not imbue the components with the qualities of that construction.

And this style of reasoning is doubly poor because the same components
can be used to construct many things for which mutually exclusive labels
are appropriate. This is true of house bricks, which might be used to
create structures that may be labelled 'internal walls', 'paving' and so
on. The house brick could not have all of these qualities at the same
time. And this is particularly true of objects in a programming language
that is capable of emulating anything. Would it be reasonable to
characterise the javascript Object as 'a dynamic collection of
name/value pairs, interface to web services and an XML parser' because
it is possible to use it to create structures that could reasonably be
labelled 'an interface to web services' or an 'XML parser'? Obviously
not.

If you are going to characterise a javascript Array you should be saying
something that is true of javascript Arrays. Either true of all
javascript Arrays or potentially true of all javascript Arrays, and it
is impossible for any javascript Array to exhibit jaggedness so the term
'jagged cannot be appropriately used to characterise javascript Arrays.

This is the crux of the question of the appropriateness of 'jagged' as a
characterisation of the javascript Array; either a (any) javascript
Array instance can be shown to exhibit jaggedness or the term is not
applicable. And as the impossibility of a javascript Array exhibiting
jaggedness has been logically proven nothing short of code demonstrating
this 'impossible phenomenon' would modify the obvious conclusion that
you are incorrect to attempt to apply the tem 'jagged' as a
characterisation of the javascript Array.
That maybe not the best term to use, but
not always the best terms are going into
programming vocabulary.
How appropriate the term may be for an array of arrays is not relevant
when characterising something that is not an array of arrays.
To foreign readers:
jagged
1. raggedly notched; sharply irregular on the surface
or at the borders.
(Random House Webster, 1998, New York) <snip>

And Randy's question was "how can something that is linear in form be
"jagged"?". We are agreed that the javascript array is not
multi-dimensional and presumably agree that it has a dimension, so it
must have just one dimension. Anything that has just one dimension can
reasonable be described as 'linear', but a straight line does not have a
sharply irregular surface or borders. So how can the single dimensional
javascript array be reasonably characterised as 'jagged'?
Question:
Why does Richard's code *not* qualify as a
multi-dimensional array?

<snip> Actually it was already answered right away why it
is *not* multi-dimensional array.

<snip>

Someone wanting to label the structure that is an array of differently
sized arrays as a 'jagged array' should be able to state a good reason
when they don't what to label an array of identically sized arrays as a
multi-dimensional array. So far you have never made such a statment.

Recall that one of the definitions of a 'jagged array' that you posted
read; "We are using the term "jagged array" to describe a
multi-dimensional array that is not necessarily rectangular", and if a
'jagged array' is an array of arrays and a 'jagged array' is a
multi-dimensional array that is not necessarily rectangular it is
difficult to see how an array of arrays can avoid being labelled a
multi-dimensional array by these definitions of a 'jagged array'.

Richard.
Feb 10 '06 #74
VK wrote:
Richard Cornford wrote:
I accessed your page with that content on 2006-02-04,
I would not have quoted it if I had not first verified
the current state of the page.
Are you publically accusing me in cheating?


Are you accusing me of lying?
That's not nice of you.
Ditto.
The relevant paragraph has been corrected July 7 2005.
You could not get not-corrected variant as of
2006-02-04 unless something is deeply wrong with your
server cach.

<snip>

Unexpected HTTP caching behaviour is certainly one explanation for the
events that transpired.

It makes no real difference. In your self-proclaimed role as "the best
specialist of *JavaScript arrays* on the planet" you still wrote those
lines, and needed to be told by a lesser mortal that they were nonsense.

Of course all the other lesser mortals who pointed out the flaws in the
aspects of your page that remain were just as correct in their
assessment, you just prefer not to listen to what they had to say.

Richard.
Feb 10 '06 #75
VK

Richard Cornford wrote:
VK wrote:
Richard Cornford wrote:
I accessed your page with that content on 2006-02-04,
I would not have quoted it if I had not first verified
the current state of the page.
Are you publically accusing me in cheating?


Are you accusing me of lying?
That's not nice of you.


Ditto.
The relevant paragraph has been corrected July 7 2005.
You could not get not-corrected variant as of
2006-02-04 unless something is deeply wrong with your
server cach.

<snip>

Unexpected HTTP caching behaviour is certainly one explanation for the
events that transpired.


ASK
It makes no real difference. In your self-proclaimed role as "the best
specialist of *JavaScript arrays* on the planet" you still wrote those
lines, and needed to be told by a lesser mortal that they were nonsense.
Yes: *6 months ago*. And they were not some complete out-off-head
nonsense as you may notice. "Negative index shortcut" does exists - but
in array methods. It was a wrong extension of its usage. And 6 month
later "negative index shortcut" is even in standard Collection
addressing schema: insertRow(-1)

So it's nothing like "jagged because it contains links of different
length" and other Of Kings And Cabbage stuff posted here over the last
48 hrs by different people.
Of course all the other lesser mortals who pointed out the flaws in the
aspects of your page that remain were just as correct in their
assessment, you just prefer not to listen to what they had to say.


Whatever was pointed out and appeared to be my mistakes was immediately
corrected. You even may notice thank you notice to Lasse Reichstein
Nielsen at the bottom of my article with disclosure of his personal
position. And the date by the way.

Feb 10 '06 #76
VK wrote:
Richard Cornford wrote: <snip>
Unexpected HTTP caching behaviour is certainly one
explanation for the events that transpired.


ASK


Ask who exactly? The number, nature, disposition and ownership of HTTP
caches along the path of any particular HTTP request is unknowable.
It makes no real difference. In your self-proclaimed role
as "the best specialist of *JavaScript arrays* on the
planet" you still wrote those lines, and needed to be
told by a lesser mortal that they were nonsense.


Yes: *6 months ago*.


So 6 months ago you were not the self-proclaimed "the best specialist of
*JavaScript arrays* on the planet"? And what exactly has changed in the
intervening period?
And they were not some complete out-off-head
nonsense as you may notice.
Just an objectively false statement.

<snip> So it's nothing like "jagged because it contains links
of different length" and other Of Kings And Cabbage stuff
posted here over the last 48 hrs by different people.


Is that intended to mean something?
Of course all the other lesser mortals who pointed out
the flaws in the aspects of your page that remain were
just as correct in their assessment, you just prefer not
to listen to what they had to say.


Whatever was pointed out and appeared to be my mistakes
was immediately corrected.

<snip>

Which suffers from your misguided filtering out of what appears (or at
the time appeared) to you not to be mistaken.

Richard.
Feb 10 '06 #77
VK

Richard Cornford wrote:
VK wrote:
Richard Cornford wrote: <snip>
Unexpected HTTP caching behaviour is certainly one
explanation for the events that transpired.


ASK


Ask who exactly? The number, nature, disposition and ownership of HTTP
caches along the path of any particular HTTP request is unknowable.


ASKnowledged

Means we just stop at this point w/o making me to request official
digitally signed FTP log from Yahoo, ICANN IP mapping for each session,
my provider IP mapping to ICANN mapping etc. etc. It's a whole bunch of
paper work from my part and it takes up to 6 months if not expedited. I
already had to pass it once but at least for my clients and at least
for some money involving copyright question. It is easier to blame on
cache really :-))
It makes no real difference. In your self-proclaimed role
as "the best specialist of *JavaScript arrays* on the
planet" you still wrote those lines, and needed to be
told by a lesser mortal that they were nonsense.


Yes: *6 months ago*.


So 6 months ago you were not the self-proclaimed "the best specialist of
*JavaScript arrays* on the planet"? And what exactly has changed in the
intervening period?


A lot of study.
Also please note that "the best specialist of *JavaScript arrays* on
the planet" had been used in the polemic context of "the best
JavaScript writers in the world in this group" which was said first and
not by me.
So it's nothing like "jagged because it contains links
of different length" and other Of Kings And Cabbage stuff
posted here over the last 48 hrs by different people.


Is that intended to mean something?


It means when when I answered OP's question using proper academically
correct terms, I had to vaste my time and patience to answer on a bunch
of mostly irrelevant posts of kind of "Prove that the Earth is
rounded", "And now prove that the sky is blue" etc.

If something is not as you taught and thought of it to be, what VK has
to do with it? Go unleash you frustration on the first available wiki
(or two), not on me.
Which suffers from your misguided filtering out of what appears (or at
the time appeared) to you not to be mistaken.


This is why I checked myself over different reputable sources to make
sure that my "mental filters" do not filter out something important.

Personal "mental filters" check is an important thing everyone needs to
make on a not so frequent but regular basis.

Feb 10 '06 #78
VK wrote:
Richard Cornford wrote:
VK wrote:
> Richard Cornford wrote:

<snip>
>> Unexpected HTTP caching behaviour is certainly one
>> explanation for the events that transpired.
>
> ASK

Ask who exactly? [...]


ASKnowledged
[...]


<URL:http://foldoc.org/?query=ASK>
<URL:http://foldoc.org/?query=ACK>
<URL:http://www.catb.org/~esr/jargon/html/A/ACK.html>
HTH

PointedEars
Feb 10 '06 #79
In article <11*********************@z14g2000cwz.googlegroups. com>, VK
<sc**********@yahoo.com> writes

Randy Webb wrote:
The best Javascript writers on the planet post here.


A bit too loud to say maybe, but let's us assume it's true :-)
Hands down. Does it
not make you wonder why nobody but VK thinks that JS has a jagged array?


Because VK is up to date the best specialist of *JavaScript arrays* on
the planet (if we decided do go by loud definitions).

btw in the reality it's just the opposite: currently Randy and Robert
are the only known people on the planet denying that JavaScript array
is jagged. (I'm not counting few amateurs posted here just for the hell
of nastiness).


It was an amateur who invented the photon. He got a Nobel Prize for it.
In English, amateur doesn't mean ignorant, it means someone who doesn't
get paid for it.

Coming back to the subject, the best that a javascript Array object can
do is to hold an array of references. If they are references to Array
objects then the programmer, with considerable effort, has implemented a
structure that has the behaviour of an n-dimensional array. The
structure might be jagged or it might never be - whichever the
programmer's code forces it to be.

The programmer might be building something else. I very much doubt if
your MIT people would use the word jagged when some points are two
dimensional and other points are five dimensional. They'd call it a
tree. (Or a forest, depending where they start from).

John

PS You're not forced to use Array objects to implement a forest/tree.
--
John Harris
Feb 10 '06 #80
VK

John G Harris wrote:
It was an amateur who invented the photon. He got a Nobel Prize for it.
In English, amateur doesn't mean ignorant, it means someone who doesn't
get paid for it.
Right. Sorry.
Coming back to the subject, the best that a javascript Array object can
do is to hold an array of references. If they are references to Array
objects then the programmer, with considerable effort, has implemented a
structure that has the behaviour of an n-dimensional array. The
structure might be jagged or it might never be - whichever the
programmer's code forces it to be.


As well as array can be sparse or "condensed". A presence of some
feature doesn't imply the necessity to use this feature on practice. At
the same time this feature can be used for the abstract model
description in order to distinguish it from another model.

We say "prototype-based" but it doesn't imply prototype usage:

<script type="text/javascript">
var a = 2;
var b = a + 2;
</script>

No one proposed (yet?) to define JavaScript as "just simply programming
language - and prototype-based if prototypes are used". :-)

P.S. If I was the president of some Programming Entities Naming
Committee I would not endorse "jagged" term. I would try to find
something better. But I'm just using what was named before me.
"static" modifier name is neither good not correct in application to
its effect. But it was named this way before me, so I have no
opportunity to use say "singleized" instead.

Feb 11 '06 #81
VK wrote:
John G Harris wrote:
It was an amateur who invented the photon. He got a Nobel Prize for it.
In English, amateur doesn't mean ignorant, it means someone who doesn't
get paid for it.


Right. Sorry.


Realy gotta love ya VK! When you're wrong, you insist you are right.
When in one of the seemingly less common instances you are right,
you're readily buffaloed.

The above definition of 'amateur' may be original, but it's not
comprehensive. A number of dictionaries, including the compact OED,
provide any of "incompetent", "inept", "non-professional", and
"lacking professional skill" as valid alternative meanings.

../rh

Feb 12 '06 #82
VK

ro********@gmail.com wrote:
VK wrote:
John G Harris wrote:
It was an amateur who invented the photon. He got a Nobel Prize for it.
In English, amateur doesn't mean ignorant, it means someone who doesn't
get paid for it.
Right. Sorry.


Realy gotta love ya VK! When you're wrong, you insist you are right.
When in one of the seemingly less common instances you are right,
you're readily buffaloed.


I'm readily agree when I'm wrong in any matter, small or big... as soon
as it is pointed to the correct explanation. Moreover I feel graceful
for being taught something I did not know. I do not agree to be wrong
just because someone says "You ignorant, that's wrong because I says
so". Such arguments do not work for me. And if you read this thread
once over you will see that 95% of posts are of this exact nature.
The above definition of 'amateur' may be original, but it's not
comprehensive. A number of dictionaries, including the compact OED,
provide any of "incompetent", "inept", "non-professional", and
"lacking professional skill" as valid alternative meanings.


Still the *first* meaning in all distionaries I can hold on is like "a
person who engages in a study, sport, or other activity for pleasure
rather than for financial benefits".

I used it in the additional meaning of "a person inexperienced or
unskilled in a particular activity". I still sorry for using it as such
response drops me down to the level of some of my opponents.

Feb 12 '06 #83
VK wrote:
<snip>
As well as array can be sparse or "condensed". A presence
of some feature doesn't imply the necessity to use this
feature on practice.
The total absence of any evidence of any javascript Array instances
exhibiting jaggedness, plus the logical proof that it is impossible for
a javascript Array instance to exhibit jaggedness, does imply that
'jagged' is an inappropriate term to apply to javascript Arrays.

<snip> P.S. If I was the president of some Programming
Entities Naming Committee
That will never happen.
I would not endorse "jagged" term. I
would try to find something better.

<snip>

Jagged is a fine term to apply to entities that exhibit jaggedness. It
is even an acceptable term to apply to entities that could exhibit
jaggedness but don't happen to in a specific instance. It is not an
appropriate term to apply to entities that are incapable of exhibiting
jaggedness, but as you are the only person who wants to do that (and are
incapable of providing any relevant justification for your decision) the
only folly here is yours, and you are the only person who need be
involved in correcting it.

Richard.
Feb 12 '06 #84
VK wrote:
Richard Cornford wrote:
VK wrote:
Richard Cornford wrote: <snip> It makes no real difference. In your self-proclaimed role
as "the best specialist of *JavaScript arrays* on the
planet" you still wrote those lines, and needed to be
told by a lesser mortal that they were nonsense.

Yes: *6 months ago*.
So 6 months ago you were not the self-proclaimed "the best
specialist of *JavaScript arrays* on the planet"? And what
exactly has changed in the intervening period?


A lot of study.


But you are the person for whom study results in your beliefs becoming
more false.
Also please note that "the best specialist of *JavaScript
arrays* on the planet" had been used in the polemic context
You still made that claim. Laughable as everyone else found it.
of "the best JavaScript writers in the world in this group"
which was said first and not by me.
An opinion about others from someone with the experience to apply
judgement to his opinions.

In your constant appeals to unnamed "professional programmers and
programming specialists" and un-cited "academic" sources you appear to
be assuming that all the contributors to this group are uninformed
amateurs dabbling in browser scripting as a hobby. While in reality the
bulk of the contributors to this group are active professional
programmers, some are browser scripting specialists and there are even
computer science academics. And you can easily see this in the veracity
of the statements they make here. Statements often made with the
openness of the individuals full name, rather than hiding behind the
anonymity of an arbitrary label.

You are certainly not a professional programmer (even if someone may be
fool enough to pay you to write computer code). That is evident, if from
no other source, in your total inability to comprehend or employ logic
(one of the mainstays of computer programming). You cannot see that in:-

| Neither C++ or Java array are *obligated* to be multi-dimensional.
| In any language I can perfectly create a simple single-dimention
| array. Applying your own thesis: "The very fact that you must
| have more than one dimension in order to implement the concept of
| `multi-dimensional' means that the term _cannot_ apply to a C++
| array (singular)."

- the conclusion cannot be derived from the perms, or that the only
conclusion that can be derived is unrelated to the conclusion you drew
and utterly trivial.

The only valid derivation is that single-dimension and multi-dimension
have a mutually exclusive relationship, which follows trivially from the
definitions of "single" and the prefix "muti", but as the C++ array can
have any number of dimensions, including one, the trivial exclusive
relationship between single-dimension and multi-dimensional doesn't
apply as a characteristic of the C++ array, only as characteristic of
individual C++ array instances.
So it's nothing like "jagged because it contains links
of different length" and other Of Kings And Cabbage stuff
posted here over the last 48 hrs by different people.


Is that intended to mean something?


It means when when I answered OP's question using proper
academically correct terms,


But those are only academically correct terms for something other than
the subject you applied them to. The supposedly academically originating
definitions you quoted said as much.
I had to vaste my time and patience to answer on a
bunch of mostly irrelevant posts of kind of "Prove
that the Earth is rounded", "And now prove that the
sky is blue" etc.
But the statement you are trying to defined is along the lines of 'air
molecules re blue, and you should be asked to defend that position if
you are going to take it.
If something is not as you taught and thought of it to be,
what VK has to do with it?
The something that is, is as it is independently of what either of us
may say on the subject, but what you are saying on the subject is
irrational and that has a great deal to do with you personally.
Go unleash you frustration on the first available wiki
(or two), not on me.
Why, you are the cause of the problem, only making you see that your
mental processes are error-producing could result in your correcting
your faulty behaviour.
Which suffers from your misguided filtering out of what
appears (or at the time appeared) to you not to be mistaken.


This is why I checked myself over different reputable sources
to make sure that my "mental filters" do not filter out
something important.


But you don't see how this self-checking is letting you down? You post
statements that are absolutely and demonstrably false when applied to
javascript on a regular basis. You argue when your are validly
corrected, maintaining the truth of your statements, posting snippets of
code that don't actually do what you think they do, and you even go off
and bother bug reporting systems with examples of things that are not
doing what you think they should be doing but are actually completely
correct. And in general waste a great deal of time being repeatedly
corrected for errors that others would only need to see pointed out
once.
Personal "mental filters" check is an important thing everyone
needs to make on a not so frequent but regular basis.


When your 'mental filters' reject the proposition that your mental
filters are fundamentally erroneous you can check yourself as often as
you like and never see reason to change anything. The opinions of others
are very impotent in forming an objective assessment of your 'mental
filters', assuming that they can avoid automatically filtering those
opinions as well.

Richard.
Feb 12 '06 #85
VK

Richard Cornford wrote:
Jagged is a fine term to apply to entities that exhibit jaggedness. It
is even an acceptable term to apply to entities that could exhibit
jaggedness but don't happen to in a specific instance. It is not an
appropriate term to apply to entities that are incapable of exhibiting
jaggedness, but as you are the only person who wants to do that (and are
incapable of providing any relevant justification for your decision) the
only folly here is yours, and you are the only person who need be
involved in correcting it.


Despite you're trying to point to my own vocabulary problems, you show
(or more probably pretending to show) even more serious vocabulary
problems.

I'm repeating it in Nth and the last time, as it's getting really
boring:

"jagged" in application to array doesn't mean "irregular on the
borders", "ragged" etc. These are meanings from the common vocabulary.

Jagged array means an array whose elements are arrays. The elements of
a jagged array *can be* of different dimensions and sizes. This is why
the term "jagged" has been originally coined. A jagged array is also
sometimes called an "array-of-arrays". Being an array-of-array and
being *able* (but not required to) to contain arrays of different
dimensions and sizes are the key features to take it away from a real
multidimensional array.

This is why I'm not happy with the term "jagged": it doesn't describe
well the nature of the entity which it names.

Still I tend to believe that the most basic knowledge of English (plus
some programming skills of course) suffice now to get the picture
right.

Here is an MSDN link
<http://msdn.microsoft.com/library/en-us/csref/html/vclrfjaggedarrays.asp>
- I took it not as the most reputable source, but as the most plain
language written among my collection.

So once again:

JavaScript / JScript array is:

Dynamic
- which doesn't imply this property usage. You can instantiate an
array of some size and stay within this size only.

Sparse
- which doesn't imply this property usage. You can go strictly by ++
/ -- index increment.

Jagged
- which doesn't imply this property usage. You can instantiate a
regular single-dimension array without any arrays as its elements.

Some sources also suggest to use "multi-typed" as indication of
possibility to have elements of different types in the array. I do not
stay for it as it seems formally incorrect to say "multi-typed" in a
type loose language.

Feb 12 '06 #86
VK wrote:
Richard Cornford wrote:
Jagged is a fine term to apply to entities that exhibit
jaggedness. It is even an acceptable term to apply to
entities that could exhibit jaggedness but don't happen
to in a specific instance. It is not an appropriate term
to apply to entities that are incapable of exhibiting
jaggedness, but as you are the only person who wants to
do that (and are incapable of providing any relevant
justification for your decision) the only folly here is
yours, and you are the only person who need be involved
in correcting it.
Despite you're trying to point to my own vocabulary problems,
you show (or more probably pretending to show) even more
serious vocabulary problems.


Like what?
I'm repeating it in Nth and the last time, as it's getting
really boring:
Yes, you should stop repeating yourself and do something about
addressing the substantive criticisms of the potion you have taken.
"jagged" in application to array doesn't mean "irregular on
the borders", "ragged" etc. These are meanings from the common
vocabulary.
If you didn't want the 'common vocabulary' applied to your statement why
did you quote the common definition?
Jagged array means an array whose elements are arrays.
So a construct that must involve at least two javascript Arrays (if it
is to have any potential to exhibit jaggedness).

<snip> This is why I'm not happy with the term "jagged": it doesn't
describe well the nature of the entity which it names.
No, it is a fine way of describing the entities that it names, the issue
here has been that you want to apply the label to an object that is not
one of the entities that it can be applied to.
Still I tend to believe that the most basic knowledge of
English
And in the absence of any apparent real understanding of English I
suppose you are only left with believing you have such an understanding.
(plus some programming skills of course)
You can always specuatle.
suffice now to get the picture right.
They should suffice, if you had either.
Here is an MSDN link
http://msdn.microsoft.com/library/en...ggedarrays.asp

A page on C# that states that "A jagged array is an array whose elements
are arrays", and so once again describes a construct created with arrays
and not a characteristic of an array (in C# or javascript).
- I took it not as the most reputable source, but as the
most plain language written among my collection.
And again a statement that describes/categorises a structure and does
not even attempt to make a statement about the nature of an array object
in the pertinent language.
So once again:

JavaScript / JScript array is:

Dynamic
- which doesn't imply this property usage. You can instantiate
an array of some size and stay within this size only.
Where dynamicsness is a fundamental characteristic of a javascript
Array. all arrays may be subject to runtime modification.
Sparse
- which doesn't imply this property usage. You can go strictly
by ++ / -- index increment.
Where sparseness is a fundamental characteristic of a javascript Array.
all javascript arrays either are sparse or can be rendered sparse.
Jagged
- which doesn't imply this property usage.
That doesn't really mean anything.
You can instantiate a regular single-dimension array
All javascript Arrays are single-dimensional, that is also a
characteristic of the javascript Array.
without any arrays as its elements.
If a 'jagged array' is an array or arrays (or any other name for a
construct that requires more than one javascript Array) then all objects
that are not arrays of arrays (or constructs made with more than one
javascript Array) cannot be a 'jagged array'. And a javascript Array is
not an array of arrays. The qualities of the construct do not transfer
to its components by virtue of their potential to be used as such
components.
Some sources also suggest to use "multi-typed" ...

<snip>

More irrelevant misdirection?

Richard.
Feb 12 '06 #87
VK

Richard Cornford wrote:
(plus some programming skills of course)


You can always specuatle.


That was not anything personal, just a side note for possible readers.
Dynamic
- which doesn't imply this property usage. You can instantiate
an array of some size and stay within this size only.


Where dynamicsness is a fundamental characteristic of a javascript
Array. all arrays may be subject to runtime modification.


*May* - but don't have to. But this attribute is used to define this
particular array model.
Sparse
- which doesn't imply this property usage. You can go strictly
by ++ / -- index increment.


Where sparseness is a fundamental characteristic of a javascript Array.
all javascript arrays either are sparse or can be rendered sparse.


*Can* - but don't have to. But this attribute is used to define this
particular array model.

var arr = new Array(1,2,3);
// Currently it's not a sparse array
// It's a condensed array (and please - it is not
// "another of VK's proprietary terms", OK?)
// the only personal term I ever used was "psi-link"
arr[1000] = 4;
// Now it's a sparse array

Jagged
- which doesn't imply this property usage.


That doesn't really mean anything.


Don't cheat now ;-)
You can instantiate a regular single-dimension array


All javascript Arrays are single-dimensional, that is also a
characteristic of the javascript Array.


Jagged array is Array Of Arrays. Note the number of the first noun:
it's sungular. Array (one) Of Arrays - not Multidimensional array. Very
important attribute used in the model description.

var arr = [[2,3],[6,5],[0,9]];
This array has evenly sized "pseudo-dimensions" but it's still
*jagged*, not multidimensional. It's still really a sinle-dimension
array, you still can do things you can do only with jagged array like:

function byNumbers(a,b) {return a-b;}
arr.sort(byNumbers);

Feb 12 '06 #88
In article <11**********************@z14g2000cwz.googlegroups .com>, VK
<sc**********@yahoo.com> writes

<snip>
Some sources also suggest to use "multi-typed" as indication of
possibility to have elements of different types in the array. I do not
stay for it as it seems formally incorrect to say "multi-typed" in a
type loose language.


You are cheating when you say that. Javascript has clearly defined
types. If an Array object has some objects that are Array objects and
some that are not then you have the general case, which is where you
should be starting from. The classification of structures built from
Array objects and non-Array elements then goes as follows :

a) Tree.
General case.
Array objects provide the links to subtrees.

b) Some trees are also n-dimensional arrays.
Their leaf nodes are all at the same depth.

c) Some n-dimensional arrays are also regular. I.e not jagged.
Array objects at the same depth all have the same length.

d) Some regular n-dimensional arrays also have the same type at all the
leaf nodes. E.g All are Numbers.
This is a common case in javascript programs.

John

--
John Harris
Feb 12 '06 #89
VK wrote:
Richard Cornford wrote: <snip>
Dynamic
- which doesn't imply this property usage. You can
instantiate an array of some size and stay within
this size only.


Where dynamicsness is a fundamental characteristic of a
javascript Array. all arrays may be subject to runtime
modification.


*May* - but don't have to. But this attribute is used to
define this particular array model.


Dynamic is not "used to define this particular array model", it is a
characteristic of javascript Arrays in general.
Sparse
- which doesn't imply this property usage. You can go
strictly by ++ / -- index increment.


Where sparseness is a fundamental characteristic of a
javascript Array. all javascript arrays either are sparse
or can be rendered sparse.


*Can* - but don't have to. But this attribute is used to
define this particular array model.


Sparse is not "used to define this particular array model", it is a
characteristic of javascript Arrays in general; all javascript arrays
can be rendered sparse (as a consequence of having the potential to be
sparse combined with being dynamic).
var arr = new Array(1,2,3);
// Currently it's not a sparse array
// It's a condensed array (and please - it is not
// "another of VK's proprietary terms", OK?)
// the only personal term I ever used was "psi-link"
You do, however, apply many terms inappropriately (or just employ them
in nonsensical contexts).
arr[1000] = 4;
// Now it's a sparse array

> Jagged
> - which doesn't imply this property usage.
That doesn't really mean anything.


Don't cheat now ;-)


I am not cheating. that is a statement that is insufficient to say
anything, and in saying nothing it also means nothing.
You can instantiate a regular single-dimension array


All javascript Arrays are single-dimensional, that is
also a characteristic of the javascript Array.


Jagged array is Array Of Arrays.


And an array of arrays is a construct built with arrays.
Note the number of the first noun:
it's sungular. Array (one) Of Arrays - not Multidimensional
array.
And the "Arrays" is plural, making the construct something that is not
an Array.
Very important attribute used in the model description.

var arr = [[2,3],[6,5],[0,9]];
A javascript Array initialiser that has three more javascript Array
initialisers defining the elements of the first array (total of 4
Arrays).
This array has evenly sized "pseudo-dimensions" but it's
still *jagged*, not multidimensional.
It has more than one dimension and you consider that as not being
multi-dimensional?
It's still really a sinle-dimension array,
"It" is not "a single dimension array", "it" is a construct made with
four javascript Arrays. "It" is a construct to which the label 'jagged
array' can be applied as it satisfies the quoted definitions, but "it"
is not a javascript Array.
you still can do things you can do only with jagged array
like:
Fine, but "it" is _not_ a javascript Array so what it is, and whatever
can be done with it, does not transfer qualities on to javascript
Arrays.
function byNumbers(a,b) {return a-b;}
arr.sort(byNumbers);


Wouldn't it be an ides, just occasionally, to test code before you post
it?

Richard.
Feb 12 '06 #90
Richard Cornford wrote:
VK wrote:
function byNumbers(a,b) {return a-b;}
arr.sort(byNumbers);


Wouldn't it be an ides, just occasionally, to test code before you post
it?


I do not understand what you mean by that. The posted source code certainly
sorts the array elements of the array encapsulated by `arr' according to the
numerical greater-than relation. `byNumbers' is one of the simplest and
most efficient comparators possible.
PointedEars
Feb 12 '06 #91
Thomas 'PointedEars' Lahn wrote:
Richard Cornford wrote:
VK wrote:
function byNumbers(a,b) {return a-b;}
arr.sort(byNumbers);


Wouldn't it be an ides, just occasionally, to test code
before you post it?


I do not understand what you mean by that. The posted source
code certainly sorts the array elements of the array encapsulated
by `arr' according to the numerical greater-than relation.
`byNumbers' is one of the simplest and most efficient comparators
possible.


No it doesn't. On IE 6 it produces a "Number Expected" error.

Arrays inherit their valueOf methods from Object.prototype, which
returns the - this - value of the object. The - this - value is not
primitive so the type-conversion to number process will call toString on
the arrays (see the definition of [[DefaultValue]]) and then convert
those values to a number, where the result will likely be Numeric NaN
(because of the commas in the string value of an array), which will
hardly enable meaningful sorting of the array.

The value returned from the comparison function is expected to be a
non-NaN number (Section 15.4.4.11) and so an error reading 'Number
Expected" when the result is Not a Number (NaN) is correct and
informative when the comparison function does return NaN.

Richard.
Feb 12 '06 #92
Richard Cornford wrote:
Thomas 'PointedEars' Lahn wrote:
Richard Cornford wrote:
VK wrote:
function byNumbers(a,b) {return a-b;}
arr.sort(byNumbers);
Wouldn't it be an ides, just occasionally, to test code
before you post it? I do not understand what you mean by that. The posted source
code certainly sorts the array elements of the array encapsulated
by `arr' according to the numerical greater-than relation.
`byNumbers' is one of the simplest and most efficient comparators
possible.


No it doesn't.


Yes, it does. But not for /this/ Array object :)
On IE 6 it produces a "Number Expected" error. [...]


I now see you are referring to the initialized value of `arr' explicitly:

| var arr = [[2,3],[6,5],[0,9]];

Yes, of course, with /that/ value (i.e. a "two-dimensional array"; sorry, I
know no better concise expression, maybe you can enlighten me) the sorting
does not work as supposed in Gecko-based UAs and Opera 8.51/Linux as well;
however, there is no error (and no warning).

Interestingly, Gecko-based UAs return the expected "2,3,6,5,0,9" while Opera
returns "0,9,6,5,2,3" as string representation of the Array object [without
modifying Array.prototype.toString() before.]
PointedEars
Feb 13 '06 #93
VK
var arr = [[2,3],[6,5],[0,9]];

function byNumbers(a,b) {return a[1]-b[1];}

arr2 = arr.sort(byNumber);

By context (if you understand what jagged array is and how does it
differ from a multidimensional one) one could see the typo.

No need to post so many useless words instead.

Feb 13 '06 #94
Thomas 'PointedEars' Lahn wrote:
Richard Cornford wrote:
Thomas 'PointedEars' Lahn wrote:
Richard Cornford wrote:
VK wrote:
> function byNumbers(a,b) {return a-b;}
> arr.sort(byNumbers); ^^^ Wouldn't it be an ides, just occasionally, to test code
before you post it?
I do not understand what you mean by that. The posted source
code certainly sorts the array elements of the array encapsulated ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ by `arr' according to the numerical greater-than relation.
^^^^^^^^
<snip>
No it doesn't.
Yes, it does. But not for /this/ Array object :)


But it was this array that the posted code was trying to sort. And I had
assumed that when you said "sorts the array elements of the array
encapsulated by `arr'" that you were referring to the same array.
On IE 6 it produces a "Number Expected" error. [...]


I now see you are referring to the initialized value of `arr'
explicitly:


Yes, I am hardly likely to maintain that arrays cannot be sorted, or
even that the array in question cannot be sorted, just that the code VK
posted and stated would work does not do anything useful when it doesn't
error and does error-out on the most common web browser in use.
| var arr = [[2,3],[6,5],[0,9]];

Yes, of course, with /that/ value (i.e. a "two-dimensional array";
sorry, I know no better concise expression, maybe you can enlighten
me)
I don't have any problem with labelling that construct as a
two-dimensional array.
the sorting does not work as supposed in Gecko-based UAs and
Opera 8.51/Linux as well;
The specification doesn't say how it is supposed to work when the
comparison function does not meet the requirements of the specification
(to return a non-NaN number).
however, there is no error (and no warning).
The interpreter's response to the flawed comparison function is not
specified so any behaviour, from erroring to silence, is acceptable.
Interestingly, Gecko-based UAs return the expected "2,3,6,5,0,9"
while Opera returns "0,9,6,5,2,3" as string representation of the
Array object [without modifying Array.prototype.toString() before.]


As the actual sorting algorithm is not specified it would be possible
for every implementation to use a different algorithm, with a different
outcome when the values returned from the comparison function are
essentially meaningless.

Richard.
Feb 13 '06 #95
VK wrote:
var arr = [[2,3],[6,5],[0,9]];

function byNumbers(a,b) {return a[1]-b[1];}

arr2 = arr.sort(byNumber);

By context (if you understand what jagged array is and how
does it differ from a multidimensional one) one could see
the typo.

No need to post so many useless words instead.


That is completely irrelevant to the message you have responded to
(Which was Message-ID: ds*******************@news.demon.co.uk).

But if you are embraced by posting code that does not work you can avoid
the condition by doing no more than testing it before you post it. It
would help if you started with the realisation that you are not at all
good at javascript and cannot trust the untested products of you mind to
be correct.

Richard.
Feb 13 '06 #96
VK

Richard Cornford wrote:
Yes, I am hardly likely to maintain that arrays cannot be sorted, or
even that the array in question cannot be sorted, just that the code VK
posted and stated would work does not do anything useful when it doesn't
error and does error-out on the most common web browser in use.


God damn it was an after-midnight typo, sorry again.

var arr = [[3,2],[4,3],[6.7]];

function by2nd(a,b) {
return a-b;
}

var arr2 = arr.sort(by2nd);

P.S. Yes it requires extra code for string values
P.P.S. Yes it requires extra code for mixed values

I hope though that the intended idea is expressed clearly now.

If you still need more explanations what "jagged" and
"multidimensional" arrays are and why they are not the same, I will try
to help.

Feb 13 '06 #97
VK wrote:
Richard Cornford wrote:
Yes, I am hardly likely to maintain that arrays cannot be sorted, or
even that the array in question cannot be sorted, just that the code
VK posted and stated would work does not do anything useful when it
doesn't error and does error-out on the most common web browser in
use.
God damn it was an after-midnight typo, sorry again.


It was not a typo, it was technically uninformed code posted in the
arrogant and misguided belief that what comes out of your mind has some
relationship to javascript. Typos are minor mistakes in code that would
work otherwise not the use of completely inappropriate expressions.
var arr = [[3,2],[4,3],[6.7]];

function by2nd(a,b) {
return a-b;
}

var arr2 = arr.sort(by2nd);

P.S. Yes it requires extra code for string values
And did you test that code? "Number Expected" again, you just don't take
good advice do you? Didn't I mention that everyone makes mistakes but it
takes a real fool to repeat them?
P.P.S. Yes it requires extra code for mixed values
I don't think so, it will error-out just as quickly with any value type
in the inner arrays.
I hope though that the intended idea is expressed clearly now.
That doesn't matter as what you have clearly expressed is probably more
informative in context.
If you still need more explanations what "jagged" and
"multidimensional" arrays are and why they are not the same,
Not why they are not the same but why you think one is applicable to an
array of arrays and the other is not.
I will try to help.


You could help by actually answering the original question and explain
how a quality of a specific type of construct can reasonably be
transferred to the components of that structure, even though those
components are logically incapable of exhibiting that quality at all.

Beyond that there is little help you could offer anyone as your
understanding of javascript is superficial and error-filled and you are
irrational.

Richard.
Feb 13 '06 #98
Richard Cornford wrote:
<snip>
But if you are embraced by posting code ...


That should be 'embarrassed', and was an example of a typo :)

Richard.

Feb 13 '06 #99
Richard Cornford said the following on 2/13/2006 2:54 AM:
Thomas 'PointedEars' Lahn wrote:
<snip>
Yes, of course, with /that/ value (i.e. a "two-dimensional array";
sorry, I know no better concise expression, maybe you can enlighten
me)


"Array of Arrays"
I don't have any problem with labelling that construct as a
two-dimensional array.


You should as JS doesn't have a two-dimensional array :)

two-dimensional leads to multi-dimensional, neither of which JS possesses.

It's an array of arrays.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 15 '06 #100

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
55526
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are...
13
2488
by: Kevin | last post by:
Help! Why are none of these valid? var arrayName = new Array(); arrayName = new Array('alpha_val', 1); arrayName = ; I'm creating/writing the array on the server side from Perl, but I
5
6500
by: Denis Perelyubskiy | last post by:
Hello, I need to make an array of elements accross forms. My javascript skills, as evident from this question, are rather rudimentary. I tried to make an associative array and index it with...
47
5028
by: VK | last post by:
Or why I just did myArray = "Computers" but myArray.length is showing 0. What a hey? There is a new trend to treat arrays and hashes as they were some variations of the same thing. But they...
22
4572
by: VK | last post by:
A while ago I proposed to update info in the group FAQ section, but I dropped the discussion using the approach "No matter what color the cat is as long as it still hounts the mice". Over the last...
2
5196
by: BrianP | last post by:
Hi, I have had to invent a work-around to get past what looks like a JavaScript bug, the malfunctioning Perl-like JavaScript array functions including SPLICE() and UNSHIFT(). I have boiled it...
21
3168
by: yeti349 | last post by:
Hi, I'm using the following code to retrieve data from an xml file and populate a javascript array. The data is then displayed in html table form. I would like to then be able to sort by each...
30
2900
by: josh | last post by:
Hi all, what does it meaning that strange sintax (look at the object :) ? if I have i.e. array.length I can use array. and is it IE/Firefox compatible??
2
2480
by: JJA | last post by:
I'm looking at some code I do not understand: var icons = new Array(); icons = new GIcon(); icons.image = "somefilename.png"; I read this as an array of icons is being built. An element of...
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6984
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5005
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4670
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3162
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3151
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1507
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
732
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.