Loading...
「ツール」は右上に移動しました。
利用したサーバー: natural-voltaic-titanium
1いいね 23回再生

How to access the first property of a Javascript object?

Is there an elegant way to access the first property of an object...

where you don't know the name of your properties
without using a loop like for .. in or jQuery's $.each

For example, I need to access foo1 object without knowing the name of foo1:
var example = {
foo1: { /* stuff1 */},
foo2: { /* stuff2 */},
foo3: { /* stuff3 */}
};
stackoverflow.com/a/23202095: stackoverflow.com/a/23202095

コメント