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で「return a && b」の構文が便利すぎた話

Last updated at Posted at 2021-05-28

タイトル通りです。

*ただ、あんまり使わない方がいい構文なのかも。。。(?)詳細はコメント欄を見てください(´ω`)ノ

JavaScriptでは、下記のような構文があります。

return a && b

これは**「a が偽の場合は a を返し、a が真の場合は b を返す」**という構文です。

aが真の時にbを返すってなんか違和感ですが、こんな感じらしいです。

しかし、なかなかに便利。

0
0
4

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?