pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Reflect/ownKeys

href="?u=http://developer.mozilla.org/static/client/inter-latin.9a3b1bc220d426ef.woff2" as="font" type="font/woff2" crossorigen="anonymous" fetchpriority="low" />

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

Reflect.ownKeys()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2016년 9월.

Reflect.ownKeys() 정적 메서드는 대상 객체의 자체 속성 키를 배열로 반환합니다.

시도해 보기

const object1 = {
  property1: 42,
  property2: 13,
};

const array1 = [];

console.log(Reflect.ownKeys(object1));
// Expected output: Array ["property1", "property2"]

console.log(Reflect.ownKeys(array1));
// Expected output: Array ["length"]

구문

js
Reflect.ownKeys(target);

매개변수

target

자체 키를 가져올 대상 객체.

반환 값

주어진 객체의 자체 속성 키를 담은 Array.

예외

targetObject가 아니면 TypeError.

설명

The Reflect.ownKeys() 메서드는 대상 객체의 자체 속성 키를 배열로 반환합니다. 반환 값은 Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target))와 동일합니다.

예제

Reflect.ownKeys() 사용하기

js
Reflect.ownKeys({ z: 3, y: 2, x: 1 }); // [ "z", "y", "x" ]
Reflect.ownKeys([]); // ["length"]

var sym = Symbol.for("comet");
var sym2 = Symbol.for("meteor");
var obj = {
  [sym]: 0,
  str: 0,
  773: 0,
  0: 0,
  [sym2]: 0,
  "-1": 0,
  8: 0,
  "second str": 0,
};
Reflect.ownKeys(obj);
// [ "0", "8", "773", "str", "-1", "second str", Symbol(comet), Symbol(meteor) ]
// Indexes in numeric order,
// strings in insertion order,
// symbols in insertion order

명세

Specification
ECMAScript® 2027 Language Specification
# sec-reflect.ownkeys

브라우저 호환성

같이 보기

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy