diff options
| author | Masahiro FUJIMOTO <mfujimot@gmail.com> | 2021-06-09 01:48:21 +0900 |
|---|---|---|
| committer | potappo <potappo@gmail.com> | 2021-06-19 16:35:37 +0900 |
| commit | e968c7e8d8c55cbcfed3a561a74162d6cee5e5c7 (patch) | |
| tree | 4c9ebfa6d800084a5643084ebfe5654fffab6015 /files/ja/web/javascript/reference/errors/cant_access_property | |
| parent | a8c13a7cb1f780c7ef085ca7443df80b6f2f9aa1 (diff) | |
| download | translated-content-e968c7e8d8c55cbcfed3a561a74162d6cee5e5c7.tar.gz translated-content-e968c7e8d8c55cbcfed3a561a74162d6cee5e5c7.tar.bz2 translated-content-e968c7e8d8c55cbcfed3a561a74162d6cee5e5c7.zip | |
Web/JavaScript/Reference/Errors/C* を更新
2021/03/29 時点の英語版に同期
Diffstat (limited to 'files/ja/web/javascript/reference/errors/cant_access_property')
| -rw-r--r-- | files/ja/web/javascript/reference/errors/cant_access_property/index.html | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/files/ja/web/javascript/reference/errors/cant_access_property/index.html b/files/ja/web/javascript/reference/errors/cant_access_property/index.html index b9bd300b79..a2fc8a56b4 100644 --- a/files/ja/web/javascript/reference/errors/cant_access_property/index.html +++ b/files/ja/web/javascript/reference/errors/cant_access_property/index.html @@ -2,38 +2,41 @@ title: 'TypeError: can''t access property "x" of "y"' slug: Web/JavaScript/Reference/Errors/Cant_access_property tags: - - Error - - JavaScript - - TypeError +- Error +- Errors +- JavaScript +- TypeError translation_of: Web/JavaScript/Reference/Errors/Cant_access_property --- <div>{{jsSidebar("Errors")}}</div> -<h2 id="メッセージ">メッセージ</h2> +<p>JavaScript の例外 "can't access property" は、 {{jsxref("undefined")}} または {{jsxref("null")}} の値に対してプロパティのアクセスが行われた場合に発生します。</p> -<pre class="syntaxbox">TypeError: Unable to get property {x} of undefined or null reference (Edge) +<h2 id="Message">エラーメッセージ</h2> + +<pre class="brush: js">TypeError: Unable to get property {x} of undefined or null reference (Edge) TypeError: can't access property {x} of {y} (Firefox) TypeError: {y} is undefined, can't access property {x} of it (Firefox) TypeError: {y} is null, can't access property {x} of it (Firefox) -Examples: +例: TypeError: x is undefined, can't access property "prop" of it TypeError: x is null, can't access property "prop" of it TypeError: can't access property "prop" of undefined TypeError: can't access property "prop" of null </pre> -<h2 id="エラータイプ">エラータイプ</h2> +<h2 id="Error_type">エラーの種類</h2> -<p>{{jsxref("TypeError")}}。</p> +<p>{{jsxref("TypeError")}}</p> -<h2 id="何がうまくいかなかったのか?">何がうまくいかなかったのか?</h2> +<h2 id="What_went_wrong">エラーの原因</h2> <p>{{jsxref("undefined")}} か {{jsxref("null")}} に対してプロパティアクセスを行いました。</p> -<h2 id="例">例</h2> +<h2 id="Examples">例</h2> -<h3 id="無効なケース">無効なケース</h3> +<h3 id="Invalid_cases">無効な場合</h3> <pre class="brush: js example-bad">// undefined and null cases on which the substring method won't work var foo = undefined; @@ -43,17 +46,17 @@ var foo = null; foo.substring(1); // TypeError: x is null, can't access property "substring" of it </pre> -<h3 id="問題解決">問題解決</h3> +<h3 id="Fixing_the_issue">問題の修正</h3> -<p><code>undefined</code> か <code>null</code> の null pointer アクセスを修正するには、たとえば <a href="/ja/docs/Web/JavaScript/Reference/Operators/typeof">typeof</a> 演算子を使用できます。</p> +<p><code>undefined</code> か <code>null</code> のヌルポインターアクセスを修正するには、たとえば <a href="/ja/docs/Web/JavaScript/Reference/Operators/typeof">typeof</a> 演算子を使用することができます。</p> <pre class="brush: js">if (typeof foo !== 'undefined') { // Now we know that foo is defined, we are good to go. }</pre> -<h2 id="関連項目">関連項目</h2> +<h2 id="See_also">関連情報</h2> <ul> - <li>{{jsxref("undefined")}}</li> - <li>{{jsxref("null")}}</li> + <li>{{jsxref("undefined")}}</li> + <li>{{jsxref("null")}}</li> </ul> |
