Get the object name of the instance created by the new operator

You can refer to the object name in instance.constructor.name. Function.name - JavaScript | MDN

function Foo() {};
let foo = new Foo();

console.log(foo.constructor.name);
//=> 'Foo'

Recommended Posts

Get the object name of the instance created by the new operator
Get the column name from the Model instance
Get the class name and method name of Controller executed by HandlerInterceptor of Spring Boot
Get the anime name for this term by scraping
Get the name of the test case in the JUnit test class
Ruby, Nokogiri: Get the element name of the selected node
Get only the ID of the container specified by docker ps
The illusion of object orientation
Extract the uniquely identifying value of the table created by PostgreSQL
Get a proxy instance of the component itself in Spring Boot
[Rails] Check the contents of the object
Get the ID of automatic numbering
Examine the contents of the WAR file generated by the project created by Spring Initializr
Email sent by JavaMail Gmail cannot restore the file name of the attached file
I want to get the field name of the [Java] field. (Old tale tone)
Get the value of enum saved in DB by Rails with attribute_before_type_cast
I want to get a list of only unique character strings by excluding fixed character strings from the file name
Get the result of POST in Java
Try using || instead of the ternary operator
[Java] Get the day of the specific day of the week
The process of understanding Gemfile by non-engineers
[Swift] Termination of the program by assertion
[Swift] Get the height of Safe Area
[Rails] Change the label name of f.label
The contents of the data saved by CarrierWave.
[Rails 6] Change redirect destination at the time of new registration / login by devise
graphql-ruby: How to get the name of query or mutation in controller Note
[Rails] Get the path name of the URL before the transition and change the link destination
Call a method of the parent class by explicitly specifying the name in Ruby
I was swallowed by the darkness of the romaji, trying to convert my name to romaji
[Ruby] How to use the map method. How to process the value of an object and get it by hash or symbol.