# functionDefinition()

[JS](https://lochiwei.gitbook.io/web/js) ⟩ [values](https://lochiwei.gitbook.io/web/js/val) ⟩ [custom functions](https://lochiwei.gitbook.io/web/js/val/type/type-functions) ⟩ functionDefinition()

{% tabs %}
{% tab title="💾 程式" %}

* replit：[isClass()](https://replit.com/@pegasusroe/isClass#typeNames.js)
* (to use it, copy and paste from 📁 module file： [typename](https://lochiwei.gitbook.io/web/js/val/type/name/typename "mention"))

```javascript
// ⭐️ content of function definition (string)
function functionDefinition(value) {
    
    // ---------------------------------------------------------------------
    // ⭐️ will throw a TypeError if value is not a function:
    //   ⛔ TypeError: 
    //      Function.prototype.toString requires that 'this' be a Function
    // ---------------------------------------------------------------------
    
    return Function.prototype.toString.call(value);
}
```

💈範例：👉 [isclass](https://lochiwei.gitbook.io/web/js/val/type/type-functions/isclass "mention")
{% endtab %}

{% tab title="⬇️ 應用" %}

* [isclass](https://lochiwei.gitbook.io/web/js/val/type/type-functions/isclass "mention") - check if value is a [class](https://lochiwei.gitbook.io/web/js/val/class "mention").
  {% endtab %}
  {% endtabs %}
