Object.getPrototypeOf() JavaScript

The JavaScript Object getPrototypeOf() method retrieves the prototype of the specified object. It will return null if there are no inherited properties.

Syntax:

Object.getPrototypeOf(object)

Parameters:
object: It represents the prototype of the specified object.

Return:
Prototype of the specified object.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
const proto = {};
const obj = Object.create(proto);
document.write(Object.getPrototypeOf(obj) === proto);
</script>
</body>
</html>