๐ฐnested type
JS โฉ value โฉ type โฉ nested type
replit โฉ nested type in JS
// A
class A {
// โญ๏ธ nested type: A.B
static B = class {
// ๐ฆ static method
static sayHi() { console.log('Hi') }
// ๐น instance method
instanceSayHi() { console.log('Hi, I am an instance of A.B !') }
};
}
// test code
A.B.sayHi(); // Hi
(new A.B).instanceSayHi(); // Hi, I am an instance of A.B !
Last updated
Was this helpful?