aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/javascript/reference/global_objects/string/tostring/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/javascript/reference/global_objects/string/tostring/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/ja/web/javascript/reference/global_objects/string/tostring/index.html')
-rw-r--r--files/ja/web/javascript/reference/global_objects/string/tostring/index.html65
1 files changed, 65 insertions, 0 deletions
diff --git a/files/ja/web/javascript/reference/global_objects/string/tostring/index.html b/files/ja/web/javascript/reference/global_objects/string/tostring/index.html
new file mode 100644
index 0000000000..75806d633f
--- /dev/null
+++ b/files/ja/web/javascript/reference/global_objects/string/tostring/index.html
@@ -0,0 +1,65 @@
+---
+title: String.prototype.toString()
+slug: Web/JavaScript/Reference/Global_Objects/String/toString
+tags:
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+ - String
+translation_of: Web/JavaScript/Reference/Global_Objects/String/toString
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>toString()</code></strong> メソッドは指定されたオブジェクトを表す文字列を返します。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/string-tostring.html")}}</div>
+
+<h2 id="Syntax" name="Syntax">構文</h2>
+
+<pre class="syntaxbox notranslate"><code><var>str</var>.toString()</code></pre>
+
+<h3 id="Return_value" name="Return_value">返値</h3>
+
+<p>呼び出したオブジェクトを表す文字列です。</p>
+
+<h2 id="Description" name="Description">詳細</h2>
+
+<p>その {{jsxref("String")}} オブジェクトは、{{jsxref("Object")}} の <code>toString</code> メソッドを上書きします。つまり、{{jsxref("Object.prototype.toString()")}} を継承しません。{{jsxref("String")}} オブジェクトの <code>toString()</code> メソッドは、そのオブジェクトを表す文字列を返します( {{jsxref("String.prototype.valueOf()")}} と同等です)。</p>
+
+<h2 id="Examples" name="Examples">例</h2>
+
+<h3 id="Using_toString" name="Using_toString()"><code>toString</code> メソッドを使う</h3>
+
+<p>以下の例は、{{jsxref("String")}} オブジェクトを表す文字列の値を表示します。</p>
+
+<pre class="brush: js notranslate">var x = new String('Hello world');
+
+alert(x.toString()) // 'Hello world' を表示します
+</pre>
+
+<h2 id="Specifications" name="Specifications">仕様</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">仕様書</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-string.prototype.tostring', 'String.prototype.toString')}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.String.toString")}}</p>
+
+<h2 id="See_also" name="See_also">関連情報</h2>
+
+<ul>
+ <li>{{jsxref("Object.prototype.toSource()")}}</li>
+ <li>{{jsxref("String.prototype.valueOf()")}}</li>
+</ul>