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 month I had
enough of extra proof that the cat doesn't hount mice anymore in more
and more situations. And the surrent sicretisme among array and hash is
the base for it.
I summarized all points in this article:
<http://www.geocities.c om/schools_ring/ArrayAndHash.ht ml>
I invite all members of the previous discussion, as well as anyone
interested in Array vs Hash mechanics in JavaScript to read this
article and to express your opinion (if any).
As each point in the article is illustrated by a concrete code sample,
I expect do not see any abstract considerations/injurations. But of
course factual mistakes illustrated by contre-samples should be edited
immediately.
Jul 23 '05
22 4644
In article <11************ **********@g47g 2000cwa.googleg roups.com>, VK
<sc**********@y ahoo.com> writes
<snip> array consists of "data holders", and length indicates the amount of data holders in each dimensions.
<snip>
The length indicates whatever the Language Standard says it indicates,
no more, no less.
If you don't like what it indicates then use another language.
John
--
John Harris
In article <11************ *********@f14g2 000cwb.googlegr oups.com>, VK
<sc**********@y ahoo.com> writes
<snip> I invite all members of the previous discussion, as well as anyone interested in Array vs Hash mechanics in JavaScript to read this article and to express your opinion (if any).
<snip>
Please stop misusing the word 'Hash'. A Hash Table, aka Hash Map, is
just one way of implementing what's needed for objects.
There are other ways of implementing what's needed. Some of them are
more appropriate when most objects have a small number of properties.
E.g. A linked list, a tree.
John
--
John Harris
> The length indicates whatever the Language Standard says it indicates, no more, no less.
Exactly. And arrayObject.len gth indicates the amount of registered
elements (data holders) in the array. And if you don't like it, you may
jump on GBasic, Focal or any other place away from here.
John G Harris wrote: Please stop misusing the word 'Hash'. A Hash Table, aka Hash Map, is just one way of implementing what's needed for objects.
There are other ways of implementing what's needed. Some of them are more appropriate when most objects have a small number of properties. E.g. A linked list, a tree.
John -- John Harris
We're not talking about possible programming entitities we could
invent/introduce for programming. Its name is Legion.
We're talking about existing separate programming entities in
JavaScript. Besides all others these are: Array, Associative array
(Hash) and HTMLCollection. Despite these are very different entities
with very different method/property sets, on the basic level there is a
huge cocktail of all three of them in the minds.
Thomas 'PointedEars' Lahn wrote: Lasse Reichstein Nielsen wrote:
"VK" <sc**********@y ahoo.com> writes: If we move on on say VBasic.Net, we have the standard triad Nothing / Empty / Null.
I'm not sure what makes it so standard, since I have never heard about it before (but then again, I never did VB).
Be proud of it. VB is rather a disease than a programming language which is why so many kiddies and so less professionals use it.
Your pointed ears again with another chunk of scum!
I don't like VB neither (looks too babish in all aspects). But VBA is
based on it, and you get good paid for good VBA modules.
But I guess you're one of these "conceptual " people who prefer to sit
with no money but keep the concept in its purity?
VK wrote: I don't like VB neither (looks too babish in all aspects). But VBA is based on it, and you get good paid for good VBA modules.
VBA is just as bad, if not worse. Unfortunately it is the only means
(AFAIK) to script MS Office apps.
But I guess you're one of these "conceptual " people who prefer to sit with no money but keep the concept in its purity?
I prefer not to take jobs when it has to be a programming language that
is a pain in the ass, yes.
PointedEars
In article <11************ **********@g43g 2000cwa.googleg roups.com>, VK
<sc**********@y ahoo.com> writes
John G Harris wrote: Please stop misusing the word 'Hash'. A Hash Table, aka Hash Map, is just one way of implementing what's needed for objects.
There are other ways of implementing what's needed. Some of them are more appropriate when most objects have a small number of properties. E.g. A linked list, a tree.
John -- John Harris
We're not talking about possible programming entitities we could invent/introduce for programming. Its name is Legion. We're talking about existing separate programming entities in JavaScript. Besides all others these are: Array, Associative array (Hash) and HTMLCollection. Despite these are very different entities with very different method/property sets, on the basic level there is a huge cocktail of all three of them in the minds.
You are talking about Hash Tables with their buckets (aka "hash memory
baskets") and their hashing algorithms.
You are saying that every object grabs kilobytes in case there are going
to be a lot of properties. And you are saying that some choices of
property names will be worst case : wasting most buckets and with lousy
performance. ECMA 262 does NOT require this.
John
--
John Harris
In article <11************ **********@g47g 2000cwa.googleg roups.com>, VK
<sc**********@y ahoo.com> writes
<John said> The length indicates whatever the Language Standard says it indicates, no more, no less.
Exactly. And arrayObject.len gth indicates the amount of registered elements (data holders) in the array. And if you don't like it, you may jump on GBasic, Focal or any other place away from here.
The Language Standard says
"The length property of this Array object is always numerically greater
than the name of every property whose name is an array index."
which is not what you've just said.
John
--
John Harris
John G Harris wrote: You are saying that every object grabs kilobytes in case there are going to be a lot of properties. And you are saying that some choices of property names will be worst case : wasting most buckets and with lousy performance. ECMA 262 does NOT require this.
John -- John Harris
I'm cannot say it until I conduct the tests. Maybe the hash mechanics
is implemented in JavaScript objects, maybe not.
On the first loot at the native objects at least (the order of
methods/properties as they listed through the for-in loop) presumably
hash mechanics is implemented or at least mimiced.
HTMLCollection for sure has nothing to do with baskets - it's build by
the order the elements appear on the page.
And in any case you as programmer do not have to worry about some
special property naming for a "better basket packaging". As you don't
need to allocate memory for your var's (talking JavaScript only).
In article <11************ **********@f14g 2000cwb.googleg roups.com>, VK
<sc**********@y ahoo.com> writes
John G Harris wrote: You are saying that every object grabs kilobytes in case there are going to be a lot of properties. And you are saying that some choices of property names will be worst case : wasting most buckets and with lousy performance. ECMA 262 does NOT require this.
John -- John Harris I'm cannot say it until I conduct the tests. Maybe the hash mechanics is implemented in JavaScript objects, maybe not.
If 'maybe not' then you mustn't say objects use hash tables.
On the first loot at the native objects at least (the order of methods/properties as they listed through the for-in loop) presumably hash mechanics is implemented or at least mimiced.
Properties might be listed in the order they were put into the object,
and you can't say what that order is for a native object.
Hash tables mimic the general requirements of associative arrays, not
the other way around.
HTMLCollecti on for sure has nothing to do with baskets - it's build by the order the elements appear on the page.
It is still built from objects, using object properties.
And in any case you as programmer do not have to worry about some special property naming for a "better basket packaging". As you don't need to allocate memory for your var's (talking JavaScript only).
With hash tables you always have to worry. They can turn round and bite
you if you don't know the hashing algorithm, and if you do know it you
can still be very unlucky.
The second sentence doesn't make sense. Do you really know what a hash
table is?
John
--
John Harris This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JGH |
last post by:
How can I check if a key is defined in an associative array?
var users = new array();
users = "Joe Blow";
users = "John Doe";
users = "Jane Doe";
function isUser (userID)
{
if (?????)
|
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 are not at all.
If you are doing *array", then you have to use only integer values for
array index, as it was since ALGOL.
|
by: scandal |
last post by:
I am a javascript newbie working on a script that checks whether a
"path" from one element in an array to another is "blocked." Currently,
the script pushes an already processed cell index (hence an integer)
into an array. To prevent rechecking already processed cells, the
script iterates through the (sorted) array to see whether that integer
is an element of the array.
After reading about javascript arrays a bit more, I thought...
|
by: Robert Mark Bram |
last post by:
Hi All!
How do you get the length of an associative array?
var my_cars= new Array()
my_cars="Mustang";
my_cars="Station Wagon";
my_cars="SUV";
alert(my_cars.length);
|
by: J. B. Moreno |
last post by:
What's the best (i.e. fastest) way to find out if an array contains a given
value? Other than looping, the only way I know to do it is to use an
associative array/hash instead....
Is there a better/faster way?
I.e if I have a list of names, what's the best way to find out if the aray
contains "jane"?
--
| |
by: VK |
last post by:
Hello,
In my object I have getDirectory() method which returns 2-dimentional
array
(or an imitation of 2-dimentional array using two JavaScript objects
with auto-handled length property - please let's us do not go into an
"each dot over i" clarification discussion now - however you want to
call - you call it ;-)
array contains records of all files in the current dir.
array contains records of all subs in the current dir
|
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 column. Once the
array elements are split, what is the best way to sort them? Thank you.
//populate data object with data from xml file.
//Data is a comma delimited list of values
var jsData = new Array();
jsData = {lib: "#field...
|
by: Leszek |
last post by:
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.
|
by: Sam Kong |
last post by:
Hello!
My question would not be very practical but just out of curiosity.
In JavaScript, Array is a subclass of Object.
Well maybe not exactly... but sort of...
For normal objects, you can access members by writing either of the
two.
obj.memberName
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |