.

HD Mp4 3gp Video
Live Update Video
Play/Download
Live 3D App
Search.Pencarian Menu

Add text send email to rh3252705.adda@blogger.com or Click this (Text porn Will delete) | Tambah teks kirim email ke rh3252705.adda@blogger.com atau Klik ini (Teks porno akan dihapus)
Total pos : 19157+

[Go Make Things] The Array.prototype.every() method always returns true for an empty array

articles

My friend Nicholas Zakas made an interesting observation on Mastodon this week: the Array.prototype.every() method always returns true for an empty array.

let arr = [];    // Returns true  arr.every(function (item) {  	return false;  });    // Also returns true  arr.every(function (item) {  	return true;  });  

Axel Rauschmayer provided an interesting explanation…

.every() implements universal quantification ("for all", ∀). And that operator is always true for empty sets…

That is also how we understand [for all] intuitively if we use it in natural language: "All humans that live on Venus have blue skin" is true (because no humans live on Venus).

The Vanilla JS Academy is a project-based online JavaScript workshop for beginners. Click here to learn more.

Cheers,
Chris

Want to share this with others or read it later? View it in a browser.

Share :

Facebook Twitter Google+ Lintasme

Related Post:

0 Komentar untuk "[Go Make Things] The Array.prototype.every() method always returns true for an empty array"

Back To Top