4

When I create a object and navigate through the _proto__ property of it I get to know that it has been inherited from Object

enter image description here

Now when I create a new object and inherit the obj object, then I get the inheritance structure like this enter image description here

Here i can understand that the object obj1 is being inherited from the object obj and the object obj is being inherited from the object Object, which is the global object.

Now my question is, when i debug in my console i get both obj and obj1 as Object but the when i debug the $scope of angularJS i get something like this

enter image description here

Why is the $scope returning b instead of Object which can be seen in all the two images above, what is so different in angularJS, am i missing something.

UPDATE 1

when I make a object of the constructor in javascript I get the function name in the constructor as shown in the image below

enter image description here

But in the case of the $scope i see no constructor function, why is that? am i missing something, please let me know

1
  • @Maximus do you know the answer for my question Commented Dec 16, 2016 at 14:11

2 Answers 2

2

This is because you're debugging minified application.

$scope is an instance of internal Scope or ChildScope class.

In minified Angular bundle the class is called something like b.

Sign up to request clarification or add additional context in comments.

1 Comment

There's no constructor because it is is deeper on the prototype chain. You will see it when logging $scope.constructor.
1

When you inspect an object in console, it is referenced by this object's class name, for example:

function Scope() {}
var s = new Scope();

enter image description here

In your case, instead of function Scope() {}, in the minified version the code looks like this function b() {} and new b() is used instead of new Scope()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.