Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
取得物件所有屬性
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
gugod  
View profile   Translate to Translated (View Original)
 More options Nov 16 2008, 7:06 am
From: gugod <gugod...@gmail.com>
Date: Sun, 16 Nov 2008 04:06:38 -0800 (PST)
Local: Sun, Nov 16 2008 7:06 am
Subject: 取得物件所有屬性
以下 keys 函式可以用來取得物件所有的屬性(property)名稱:

    function keys(o) {
        var r = [];
        for(var a in o) { r.push(a); }
        return r;
    }

使用方法如:

    pet = {
      "nick": "little black",
      "age": 3,
      "type": "cat"
    };

    properties = keys(pet); // [ "nick", "age", "type" ]


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google