Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js get class from instance

class Language {}

const l1 = new Language();

console.log(l1.constructor.name); //Language


// Works too
(1)?.constructor.name // "Number"
(false)?.constructor.name // "Boolean"
(1)?.constructor.name // "Number"
("aa")?.constructor.name // "String"
([])?.constructor.name // "Array"
({a:"a"})?.constructor.name // "Object"
(false)?.constructor.name // "Boolean"
(null)?.constructor.name // undefined
(document)?.constructor.name // "HTMLDocument"
(myImageElement)?.constructor.name // "HTMLImageElement"
Comment

PREVIOUS NEXT
Code Example
Javascript :: post json example 
Javascript :: what triggers formik validate 
Javascript :: difference between ajax and node js 
Javascript :: Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec. 
Javascript :: js array includes multiple items 
Javascript :: setup react app from cpanel 
Javascript :: js get first and last day of previous month 
Javascript :: shift and unshift js 
Javascript :: convert string to array javascript 
Javascript :: react controlled input 
Javascript :: convert celsius to fahrenheit javascript 
Javascript :: redux saga use navigation 
Javascript :: js dictionary 
Javascript :: javascript tostring 
Javascript :: how to print two arrays together 
Javascript :: js display image from external url 
Javascript :: get previous link javascript 
Javascript :: node js if no arguments 
Javascript :: UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON 
Javascript :: how to add footer in every page jspdf 
Javascript :: date and time javascript 
Javascript :: Export multiple variable javascript 
Javascript :: nested ternarys javascript 
Javascript :: javascript check if length is greater than 0 
Javascript :: splice js 
Javascript :: javascript debugger online 
Javascript :: get month from timestamp javascript 
Javascript :: react route multiple components 
Javascript :: how to get MathJax 
Javascript :: generate unique random number in javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =