1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【JavaScript】Uncaught ReferenceError: gon is not defined

Posted at

記事概要

JavaScriptによって発生したエラーUncaught ReferenceError: gon is not definedを解消する方法について、まとめる

事象

下記エラーがコンソール上で発生する

Uncaught ReferenceError: gon is not defined

エラー原因

JavaScriptで定義した変数名 or 関数名が存在しないため、エラーが発生
JavaScriptを使用しないページで発生する

対応方法

変数名 or 関数名が存在しない場合、それ以降のコードを読まないように下記を追記

if (typeof gon == 'undefined'){ return false;} // 追記
 // 省略

※処理が開始する前に記述すること

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?