Hello guys, tell me what is difference between _proto_ and [[PROTOTYPE]], don't confuse with .prototype | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hello guys, tell me what is difference between _proto_ and [[PROTOTYPE]], don't confuse with .prototype

Let b = {} b._proto_ === Object.prototype b.[[PROTOTYPE]] === Object.prototype Is it the same?

15th Jun 2021, 7:48 PM
Тимур Завьялов
Тимур Завьялов - avatar
9 Answers
+ 3
yes; __proto__ (double dunder as prefix and postfix) is same as [[prototype]] they are internal property of object.. the former is deprecated (in favor of getPrototypeOf() method), even if still often supported for ascending compatibility ;) the later is a notation used in books/documentations and has no use in code https://developer.mozilla.org/en-US/docs/Web/JavaScript/The_performance_hazards_of_prototype_mutation
15th Jun 2021, 7:59 PM
visph
visph - avatar
+ 1
Object.getPrototypeOf(b) -> Object.prototype
15th Jun 2021, 8:28 PM
Artur
Artur - avatar
+ 1
Тимур Завьялов look at this schema, hopefully it will help you to understand https://code.sololearn.com/W79SrO1dgHFr/?ref=app
15th Jun 2021, 8:47 PM
Artur
Artur - avatar
+ 1
Artur, basically, I got it
15th Jun 2021, 8:59 PM
Тимур Завьялов
Тимур Завьялов - avatar
+ 1
Тимур Завьялов I wrote down js code in there. May be it will help you as well. Good luck 🤗
15th Jun 2021, 9:28 PM
Artur
Artur - avatar
0
visph, and what will it look like with getPrototypeOf?
15th Jun 2021, 8:07 PM
Тимур Завьялов
Тимур Завьялов - avatar
0
visph, thanks)
15th Jun 2021, 8:11 PM
Тимур Завьялов
Тимур Завьялов - avatar
0
Artur, thanks)
15th Jun 2021, 8:38 PM
Тимур Завьялов
Тимур Завьялов - avatar