> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/js/val/type/nested.md).

# nested type

[JS](/web/js.md) ⟩ [value](/web/js/val.md) ⟩ [type](/web/js/val/type.md) ⟩ 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 %}
