Search code examples
javascriptgoogle-chromeobjectconstructorgoogle-chrome-devtools

What does the letters in front of the objects mean in Google Chrome dev tools?


There is the question I met while searching what do the letters in front of the objects in Chrome dev tools mean.

In my case I have the m letter in front of the $scope variable in AngularJS. E.g.:

vm
m {$id: 1520, $$childTail: m, $$childHead: b, $$prevSibling: m, $$nextSibling: null, …}

enter image description here

So, the linked above question comes to the following conclusion:

It's the name of the constructor used to create the model object.

That conclusion brings a few questions. I believe they are tightly connected to each other, so I decided to create a single question for all of them.

  1. What is the difference between the ordinary JS object and the model object?

  2. What is the difference between the ordinary JS object`s constructor and the model object`s constructor?

  3. Why did Chrome decided to prepend the letters for the model objects, but decided to avoid doing so for the ordinary JS objects?

UPDATE

After the first comment to the question I decided to try the following example:

function A() {}
 *undefined*
new A()
 *A {}*
{}
 *{}*

enter image description here

That helped me to understand that the letter prepended to the object is just a name of the constructor. Is my understanding correct?


Solution

  • I believe that letter is done by the framework when it minifies, what you are probably seeing is their Class or Object in its minified form represented as a letter, basically a wrapper to the object you made.