Answers for "typescript get class name"

0

typescript get class properties

//Given the class A:
class A {
    constructor() {
        this.a1 = "";
        this.a2 = "";
    }
}

//you get the properties with:
let a = new A();
let array = return Object.getOwnPropertyNames(a);
Posted by: Guest on November-08-2021
0

typescript get class name

class YourClass {}

const fooInst = new YourClass();

//get the classname:
console.log(fooInst.constructor.name); // YourClass
console.log(YourClass.name);
Posted by: Guest on May-04-2022

Code answers related to "TypeScript"

Browse Popular Code Answers by Language