JavaScript > Why doesn't the Object "Class Name" show in my browser terminal?

Viewed 28

So I am learning JavaScript. And in this training the are teaching about Object Class. And at a certain point, they show that in the browser console, the object class name is shown when console.log.

But, when I am doing it, it does not happen. It only shows that it is an Object, but it does not show the class name. Any idea what is wrong?

p.s. I am using the Mozilla browser.

[This training shows "Backpack" as the object class name in the browser terminalThis one here is my code, and it does not show the object class name in my browser console

1 Answers

you can see the name of class(Backpack).

enter image description here

and also you can see by using constructor.name.

class Test {}

const testInstance = new Test();

console.log(testInstance);
console.log(testInstance.constructor.name);
Related