# nested type

[JS](../..) ⟩ [value](..) ⟩ [type]() ⟩ nested type

{% tabs %}
{% tab title="💈範例" %}
replit ⟩ [nested type in JS](https://replit.com/@pegasusroe/nested-types-in-JS#index.js)

```javascript
// 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 !
```
{% endtab %}
{% endtabs %}
