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?

More than 1 year has passed since last update.

【JavaScript】関数を別ファイルでも使えるようにする【忘備録】

Posted at

JavaScriptのファイル間で同じ関数を使用したい場合は

const 関数名 = () => {
  
};

から

window.関数名 = () => {

};

に変えるだけで、ファイルを跨いで使用することができるようになります。
ファイルを分割したいときなどに便利です。

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?