Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to get the Class Name of an Object in JavaScript

class Language {
 getClassName() {
  return this.constructor.name;
 }
}

const l1 = new Language ();

const objClassName = l1.getClassName();

console.log(objClassName);
Source by itsjavascript.com #
 
PREVIOUS NEXT
Tagged: #How #Class #Name #Object #JavaScript
ADD COMMENT
Topic
Name
1+2 =