Movatterモバイル変換


[0]ホーム

URL:


  1. Tecnología web para desarrolladores
  2. JavaScript
  3. Referencia de JavaScript
  4. Objetos globales
  5. Object
  6. Object.getPrototypeOf()

Esta página ha sido traducida del inglés por la comunidad.Aprende más y únete a la comunidad de MDN Web Docs.

View in EnglishAlways switch to English

Object.getPrototypeOf()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨julio de 2015⁩.

Resumen

El métodoObject.getPrototypeOf() devuelve el prototipo (es decir, el valor de la propiedad interna[[Prototype]]) del objeto especificado.

Sintaxis

Object.getPrototypeOf(obj)

Parámetros

obj

El objeto cuyo prototipo va a ser devuelto.

Valor Devuelto

El prototipo del objeto dado. Si no existen propiedades heredadas se devolveránull.

Ejemplos

js
var proto = {};var obj = Object.create(proto);Object.getPrototypeOf(obj) === proto; // true

Notas

En ES5, lanzará una excepciónTypeError si el parámetroobj no es un objeto. en ES6, El parámetro será forzado a unObject.

js
> Object.getPrototypeOf('foo')TypeError: "foo" is not an object  // ES5 code> Object.getPrototypeOf('foo')String.prototype                   // ES6 code

Especificaciones

Specification
ECMAScript® 2026 Language Specification
# sec-object.getprototypeof

Compatibilidad con navegadores

Mira también

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp