0
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 3 years have passed since last update.

備忘録 javascript URLでの条件分岐

Posted at

location.pathname …… 現在ページURLのパス名を参照する

matchメソッドの使い方

matchとは、文字列を扱うStringオブジェクトで標準に用意されているメソッド。
matchは、一般的に文字列に含まれている特定の文字を検索したいときに活用します。基本的な使い方は以下の通りです。

const str = 文字列
 
str.match( 検索条件 )
if (location.pathname.match("tweets/new)
0
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
0
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?