0

I am wondering that, what is the set __proto__ in Javascript Console. I searched on Google, but there is only __proto__ in results.

Machavity
  • 30,841
  • 27
  • 92
  • 100
Adil Heybetov
  • 13
  • 1
  • 7
  • https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/proto – Mohammad Faisal Mar 29 '17 at 05:32
  • Looks like a setter. The value is a function, right? And there's also a `get __proto__` alongside of it? – Bergi Mar 29 '17 at 05:33
  • @JaromandaX & co. - If you expand even a default empty `{}` object's `__proto__` in the console it shows properties/methods including `get __proto__:__proto__()` and `set __proto__:__proto__()`. (At least, Chrome does that.) I assume that's what this is about. This is one of those situations when a screenshot would probably help make things clearer, but I believe the OP is asking about default behaviour. – nnnnnn Mar 29 '17 at 05:46
  • Thanks @nnnnnn - it looks slightly different in Firefox - `set: set __protot__()` – Jaromanda X Mar 29 '17 at 05:51

1 Answers1

0
var Circle = function () {};
var shape = {};
var circle = new Circle();
shape.__proto__ = circle;
console.log(shape.__proto__ === circle); // true

Like the above code, maybe it was not set__proto__and more like set.__proto__ var set= {};

  • If you expand an object's `__proto__` in the console it shows properties/methods including `get __proto__:__proto__()` and `set __proto__:__proto__()`. (At least, Chrome does that.) There's no `set` object. – nnnnnn Mar 29 '17 at 05:39
  • http://stackoverflow.com/questions/10592753/how-to-define-setter-getter-on-prototype - like this one ? – shadowclone Mar 29 '17 at 05:43