node

Javascript Hash

// Empty hash table
var hashObject = {};
// Hash table with two key:value pairs:
var hashObject = {"key1":"value1","key2":"value2"};

จะเขียน key แบบไม่มี quote ก็ได้ แต่ต้องไม่ตรงกับคำสงวน

var hashObject = {key : "value"}; // create

hashObject["key"] = "new value"; // add/replace

delete(hashObject["key"]); // delete

for (var i in object) // is equivalent to foreach

Check for a presence of a particular key:
if ("key" in hashObject) // returns true or false

Comments

คนแปลกหน้า's picture

อันนี้เป็

อันนี้เป็นภาษาอะไรหรือครับ โทษนะครับ พอดีว่า ไม่ค่อยรู้เรื่องคอมพ์

ตามมาจาก blog คุณ peetai

คนแปลกหน้า's picture

นั่นสิคับ

นั่นสิคับ ผมก็อยากรู้เหมือนกัล

คนแปลกหน้า's picture

more javascript themes

more javascript themes

คนแปลกหน้า's picture

Nice write up

Nice write up

คนแปลกหน้า's picture

Helpful. Thank you

Helpful. Thank you

คนแปลกหน้า's picture

Informative, but I need to

Informative, but I need to ask: is there a shortcut to this thing?

คนแปลกหน้า's picture

I found your post if much

I found your post if much informative for me. I was looking for Javascript Hash recently. Now I am very happy to find this feature. Thank you

คนแปลกหน้า's picture

The link is really

The link is really important. I appreciate u for the link. Thanks a lot. Carry on man.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.