diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/javascript/reference/global_objects/function/tosource | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-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/function/tosource')
-rw-r--r-- | files/ja/web/javascript/reference/global_objects/function/tosource/index.html | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/files/ja/web/javascript/reference/global_objects/function/tosource/index.html b/files/ja/web/javascript/reference/global_objects/function/tosource/index.html new file mode 100644 index 0000000000..6fdc0141be --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/function/tosource/index.html @@ -0,0 +1,69 @@ +--- +title: Function.prototype.toSource() +slug: Web/JavaScript/Reference/Global_Objects/Function/toSource +tags: + - Function + - JavaScript + - Method + - Non-standard + - Obsolete +translation_of: Web/JavaScript/Reference/Global_Objects/Function/toSource +--- +<div>{{JSRef}} {{obsolete_header}}</div> + +<p><strong><code>toSource()</code></strong> メソッドは、オブジェクトのソースコードを表す文字列を返します。このメソッドは通常、コード中で明示的に呼び出されるのではなく、 JavaScript から内部的に呼び出されます。デバッグ中にオブジェクトの内容を調査する目的で <code>toSource()</code> を呼び出すことができます。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox notranslate"><var>function</var>.toSource(); +</pre> + +<h3 id="Return_value" name="Return_value">返値</h3> + +<p>オブジェクトのソースコードを表す文字列です。</p> + +<h2 id="Description" name="Description">解説</h2> + +<h3 id="Native_functions" name="Native_functions">ネイティブ関数</h3> + +<p>組込みの {{jsxref("Function")}} オブジェクトでは、 <code>toSource()</code> は次の文字列を返してソースコードが使用できないことを示します。</p> + +<pre class="brush: js notranslate">function Function() { + [native code] +} +</pre> + +<h3 id="Custom_functions" name="Custom_functions">独自の関数</h3> + +<p>独自に作成した関数では、 <code>toSource()</code> はオブジェクトを定義する JavaScript のソースコードを文字列として返します。</p> + +<pre class="brush: js notranslate">// 例: +function hello() { + console.log("Hello, World!"); +} + +hello.toSource(); +</pre> + +<pre class="brush: js notranslate">// 結果: +"function hello() { + console.log(\"Hello, World!\"); +}"</pre> + +<h2 id="Specifications" name="Specifications">仕様書</h2> + +<p>いずれの標準仕様でも定義されていません。</p> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> + +<div> +<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div> + +<p>{{Compat("javascript.builtins.Function.toSource")}}</p> +</div> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li>{{jsxref("Object.prototype.toSource()")}}</li> +</ul> |