Hashtable of JavaScript

Source: Internet
Author: User

Hashtable (hash table) is a collection-type data structure that is directly accessed based on key-value pairs.

The query efficiency of a hash table is very high because it can be accessed directly by key.

Arrays are searched by traversing subscripts.

Normally, objects in javascript can dynamically add or delete attributes. Therefore, objects can be viewed as a set,

Javascript objects are inherently hashtable.

Construct a hashtable object as follows:

VaR hashtable = {name: "will", age: 18} // if the value is a string, it must be placed between quotation marks (single or double)

Simple hashtable object:

Value: hashtable. Name or hashtable ["name"];

Delete: delete hashtable. Name or delete hashtable ["name"]

The hashtable object can also store arrays, such as VAR hashtable = {A: [,], B: "will "};

Hashtable ["A"] can be used to operate on an array, for example, hashtable ["A"]. join () or hashtable ["A"]. sort () and so on.

* ***************************** After hashtable knowledge point from the Moon film "Return of the King" ** **************************************

******************* *********************************** *************

 

 

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.