LoginSignup
10
11

More than 5 years have passed since last update.

1行で今日の曜日を取得JavaScript

Posted at
//日本語
var week='日月火水木金土'[new Date().getDay()];

//英語
var week=['sun','mon','tue','wed','thu','fri','sat'][new Date().getDay()];

これは日本語というか漢字の表語文字の特性が功を奏した。

10
11
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
10
11