TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

JavaScript Reflect getPrototypeOf() Method

JavaScript Reflect getPrototypeOf() Method with examples on javascript reflect methods, apply() construct(), defineProperty() method, deleteProperty(), get(), getOwnPropertyDescriptor(), getPrototypeOf(), has(), isExtensible(), ownKeys(), setPrototypeOf() etc.

<< Back to JAVASCRIPT

JavaScript Reflect.getPrototypeOf() Method

The static Reflect.getPrototypeOf() method is used to return the prototype of the specified object. It is same as the method Object.getProtptypeOf( ).

Syntax:

Reflect.getPrototypeOf(obj)

Parameters:

Obj: It is the target object of which to get the prototype.

Return value:

This method returns the prototype of the given object.

Exceptions:

A TypeError, if you give it an invalid target such as a Number or String literal, null or undefined.

Browser Support:

Chrome 49
Edge 12
Firefox 42
Opera 36

Example 1

// create a object with no parent
const h = Object.create (null);

console.log (
 Reflect.getPrototypeOf ( h ) === null
); 

Output:

 true

Example 2

const hurry1 = {
  property1: 42
};
const hello = Reflect.getPrototypeOf(hurry1);
console.log(hello);

Output:

[object Object] { ... }

Example 3

const hurry1 = {
  property1: 42
};
const hello = Reflect.getPrototypeOf(hurry1);
console.log(Reflect.getPrototypeOf(hello));

Output:

 null
Next TopicJavaScript Reflect




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf