6
4

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で配列のチェックにeveryを使う時は注意

Posted at

everyは配列要素が0のとき必ずtrueを返すため、知らずに使うと意図しない動作を引き起こす可能性があるので注意が必要です。

image.png

MDNに注意書きはしてあるが、一致するものがないんだからfalseじゃないか?と思う。。。

image.png
参考:https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/every

6
4
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
6
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?