# prefer-string

[JS](../../../..) ⟩ [value](../../..) ⟩ [type](../../../type) ⟩ [conversion](../../../type/convert) ⟩ [object -> primitive]() ⟩ prefer-string

{% hint style="success" %}
* <mark style="color:yellow;">**prefer-**</mark><mark style="color:red;">**string**</mark>：preferring a string (if conversion is possible)
{% endhint %}

{% tabs %}
{% tab title="🗺️ 圖表" %}
<img src="https://2527454625-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfvEFZnSBhKT6fJmus0%2Fuploads%2FSrzahlasA7PWTpTjnyuU%2Fprefer.string.svg?alt=media&#x26;token=724a2745-72e2-4d65-80be-7c680028413e" alt="" class="gitbook-drawing">
{% endtab %}

{% tab title="👥 相關" %}
* :no\_entry: "<mark style="color:purple;">**prefer-string**</mark>" may result in [type](../../../../err/type "mention"):exclamation:
{% endtab %}

{% tab title="📗 參考" %}
* [ ] [javascript-the-definitive-guide](../../../../../master/ref/javascript-the-definitive-guide "mention") ⟩&#x20;
  * [ ] 3.9.2 Explicit Conversions
  * [ ] 3.9.3 Object to Primitive Conversions
  * [ ] 14.4.7
{% endtab %}

{% tab title="📘 手冊" %}
* [Object.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString) - object to string.
* [Object.prototype.valueOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/valueOf) - object to (primitive) value, if exists.
{% endtab %}
{% endtabs %}
